1 2/* 3 * Copyright 2010 Google Inc. 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 11#ifndef SkGpuCanvas_DEFINED 12#define SkGpuCanvas_DEFINED 13 14#include "SkCanvas.h" 15 16class GrContext; 17class GrRenderTarget; 18 19/** 20 * Subclass of canvas that creates devices compatible with the GrContext pass 21 * to the canvas' constructor. 22 */ 23class SkGpuCanvas : public SkCanvas { 24public: 25 /** 26 * The GrContext object is reference counted. When passed to our 27 * constructor, its reference count is incremented. In our destructor, the 28 * GrGpu's reference count will be decremented. 29 * GrRenderTarget represents the rendering destination in the underlying 30 * 3D API. Its reference count is incremented in the constructor and 31 * decremented in the destructor. 32 */ 33 explicit SkGpuCanvas(GrContext*, GrRenderTarget*); 34 virtual ~SkGpuCanvas(); 35 36 /** 37 * Override from SkCanvas. Returns true, and if not-null, sets size to 38 * be the width/height of our viewport. 39 */ 40 virtual bool getViewport(SkIPoint* size) const; 41 42#if 0 43 virtual int saveLayer(const SkRect* bounds, const SkPaint* paint, 44 SaveFlags flags = kARGB_ClipLayer_SaveFlag) { 45 return this->save(flags); 46 } 47#endif 48 49private: 50 GrContext* fContext; 51 52 typedef SkCanvas INHERITED; 53}; 54 55#endif 56 57 58