1 2/* 3 * Copyright 2006 The Android Open Source Project 4 * 5 * Use of this source code is governed by a BSD-style license that can be 6 * found in the LICENSE file. 7 */ 8 9 10#ifndef SkTransparentShader_DEFINED 11#define SkTransparentShader_DEFINED 12 13#include "SkShader.h" 14 15class SkTransparentShader : public SkShader { 16public: 17 SkTransparentShader() {} 18 19 virtual uint32_t getFlags() SK_OVERRIDE; 20 virtual bool setContext( const SkBitmap& device, 21 const SkPaint& paint, 22 const SkMatrix& matrix) SK_OVERRIDE; 23 virtual void shadeSpan(int x, int y, SkPMColor[], int count) SK_OVERRIDE; 24 virtual void shadeSpan16(int x, int y, uint16_t span[], int count) SK_OVERRIDE; 25 26 // overrides for SkFlattenable 27 virtual Factory getFactory() SK_OVERRIDE; 28 virtual void flatten(SkFlattenableWriteBuffer&) SK_OVERRIDE; 29 30private: 31 // these are a cache from the call to setContext() 32 const SkBitmap* fDevice; 33 uint8_t fAlpha; 34 35 SkTransparentShader(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {} 36 37 static SkFlattenable* Create(SkFlattenableReadBuffer& buffer) { 38 return SkNEW_ARGS(SkTransparentShader, (buffer)); 39 } 40 41 typedef SkShader INHERITED; 42}; 43 44#endif 45 46