SkBitmapProcShader.h revision b6e161937bc890f0aa12ac5e27415d4d260ea6e0
1ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com 2ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com/* 3ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Copyright 2006 The Android Open Source Project 4ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * 5ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Use of this source code is governed by a BSD-style license that can be 6ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * found in the LICENSE file. 7ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com */ 8ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com 98a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifndef SkBitmapProcShader_DEFINED 118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#define SkBitmapProcShader_DEFINED 128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkShader.h" 148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkBitmapProcState.h" 158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass SkBitmapProcShader : public SkShader { 178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.compublic: 188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkBitmapProcShader(const SkBitmap& src, TileMode tx, TileMode ty); 198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com // overrides from SkShader 21b6e161937bc890f0aa12ac5e27415d4d260ea6e0junov@chromium.org virtual bool isOpaque() const SK_OVERRIDE; 228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com virtual bool setContext(const SkBitmap&, const SkPaint&, const SkMatrix&); 238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com virtual uint32_t getFlags() { return fFlags; } 248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com virtual void shadeSpan(int x, int y, SkPMColor dstC[], int count); 258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com virtual void shadeSpan16(int x, int y, uint16_t dstC[], int count); 268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com virtual void beginSession(); 278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com virtual void endSession(); 287c2f27d788fff9dbf66a6d52753e47f786a313c0reed@google.com virtual BitmapType asABitmap(SkBitmap*, SkMatrix*, TileMode*, 297c2f27d788fff9dbf66a6d52753e47f786a313c0reed@google.com SkScalar* twoPointRadialParams) const; 308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com static bool CanDo(const SkBitmap&, TileMode tx, TileMode ty); 328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 337c2f27d788fff9dbf66a6d52753e47f786a313c0reed@google.com static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) { 348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com return SkNEW_ARGS(SkBitmapProcShader, (buffer)); 358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com // override from flattenable 388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com virtual bool toDumpString(SkString* str) const; 398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comprotected: 418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkBitmapProcShader(SkFlattenableReadBuffer& ); 428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com virtual void flatten(SkFlattenableWriteBuffer& ); 438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com virtual Factory getFactory() { return CreateProc; } 448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkBitmap fRawBitmap; // experimental for RLE encoding 468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkBitmapProcState fState; 478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com uint32_t fFlags; 488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 497c2f27d788fff9dbf66a6d52753e47f786a313c0reed@google.comprivate: 508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com typedef SkShader INHERITED; 518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com}; 528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 54