blob: bb6de961b08e72d003dc4cef31a5e12f426a4f79 [file] [log] [blame]
reed@google.comc9062042012-07-30 18:06:00 +00001/*
2 * Copyright 2012 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkSurface_Base_DEFINED
9#define SkSurface_Base_DEFINED
10
11#include "SkSurface.h"
12
13class SkSurface_Base : public SkSurface {
14public:
15 SkSurface_Base(int width, int height) : INHERITED(width, height) {}
16
17 virtual SkCanvas* onNewCanvas() = 0;
18 virtual SkSurface* onNewSurface(const SkImage::Info&, SkColorSpace*) = 0;
19 virtual SkImage* onNewImageShapshot() = 0;
20
21 /**
22 * Default implementation:
23 *
24 * image = this->newImageSnapshot();
25 * if (image) {
26 * image->draw(canvas, ...);
27 * image->unref();
28 * }
29 */
30 virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*);
31
32private:
33 typedef SkSurface INHERITED;
34};
35
36#endif
37