2010-12-22 21:39:39 +00:00
|
|
|
|
2011-07-28 14:26:00 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2010 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
2010-12-22 21:39:39 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2011-07-28 14:26:00 +00:00
|
|
|
|
2010-12-22 21:39:39 +00:00
|
|
|
#ifndef SkGpuCanvas_DEFINED
|
|
|
|
#define SkGpuCanvas_DEFINED
|
|
|
|
|
|
|
|
#include "SkCanvas.h"
|
|
|
|
|
|
|
|
class GrContext;
|
2011-01-18 20:57:22 +00:00
|
|
|
class GrRenderTarget;
|
2010-12-22 21:39:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Subclass of canvas that creates devices compatible with the GrContext pass
|
|
|
|
* to the canvas' constructor.
|
|
|
|
*/
|
|
|
|
class SkGpuCanvas : public SkCanvas {
|
|
|
|
public:
|
|
|
|
/**
|
2011-01-11 18:59:23 +00:00
|
|
|
* The GrContext object is reference counted. When passed to our
|
|
|
|
* constructor, its reference count is incremented. In our destructor, the
|
2010-12-22 21:39:39 +00:00
|
|
|
* GrGpu's reference count will be decremented.
|
2011-01-18 20:57:22 +00:00
|
|
|
* GrRenderTarget represents the rendering destination in the underlying
|
|
|
|
* 3D API. Its reference count is incremented in the constructor and
|
|
|
|
* decremented in the destructor.
|
2010-12-22 21:39:39 +00:00
|
|
|
*/
|
2011-01-18 20:57:22 +00:00
|
|
|
explicit SkGpuCanvas(GrContext*, GrRenderTarget*);
|
2010-12-22 21:39:39 +00:00
|
|
|
virtual ~SkGpuCanvas();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Override from SkCanvas. Returns true, and if not-null, sets size to
|
|
|
|
* be the width/height of our viewport.
|
|
|
|
*/
|
|
|
|
virtual bool getViewport(SkIPoint* size) const;
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
virtual int saveLayer(const SkRect* bounds, const SkPaint* paint,
|
|
|
|
SaveFlags flags = kARGB_ClipLayer_SaveFlag) {
|
|
|
|
return this->save(flags);
|
|
|
|
}
|
|
|
|
#endif
|
2011-01-11 18:59:23 +00:00
|
|
|
|
2010-12-22 21:39:39 +00:00
|
|
|
private:
|
|
|
|
GrContext* fContext;
|
|
|
|
|
|
|
|
typedef SkCanvas INHERITED;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|