OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkSurface_Base_DEFINED | 8 #ifndef SkSurface_Base_DEFINED |
9 #define SkSurface_Base_DEFINED | 9 #define SkSurface_Base_DEFINED |
10 | 10 |
11 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
12 #include "SkSurface.h" | 12 #include "SkSurface.h" |
13 #include "SkSurfacePriv.h" | 13 #include "SkSurfacePriv.h" |
14 | 14 |
15 class SkSurface_Base : public SkSurface { | 15 class SkSurface_Base : public SkSurface { |
16 public: | 16 public: |
17 SkSurface_Base(int width, int height, const SkSurfaceProps*); | 17 SkSurface_Base(int width, int height, const SkSurfaceProps*); |
18 SkSurface_Base(const SkImageInfo&, const SkSurfaceProps*); | 18 SkSurface_Base(const SkImageInfo&, const SkSurfaceProps*); |
19 virtual ~SkSurface_Base(); | 19 virtual ~SkSurface_Base(); |
20 | 20 |
21 virtual GrBackendObject onGetTextureHandle(TextureHandleAccess) { | 21 virtual GrBackendObject onGetTextureHandle(BackendHandleAccess) { |
22 return 0; | 22 return 0; |
23 } | 23 } |
24 | 24 |
| 25 virtual bool onGetRenderTargetHandle(GrBackendObject*, BackendHandleAccess)
{ |
| 26 return false; |
| 27 } |
| 28 |
25 /** | 29 /** |
26 * Allocate a canvas that will draw into this surface. We will cache this | 30 * Allocate a canvas that will draw into this surface. We will cache this |
27 * canvas, to return the same object to the caller multiple times. We | 31 * canvas, to return the same object to the caller multiple times. We |
28 * take ownership, and will call unref() on the canvas when we go out of | 32 * take ownership, and will call unref() on the canvas when we go out of |
29 * scope. | 33 * scope. |
30 */ | 34 */ |
31 virtual SkCanvas* onNewCanvas() = 0; | 35 virtual SkCanvas* onNewCanvas() = 0; |
32 | 36 |
33 virtual SkSurface* onNewSurface(const SkImageInfo&) = 0; | 37 virtual SkSurface* onNewSurface(const SkImageInfo&) = 0; |
34 | 38 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 97 |
94 SkImage* SkSurface_Base::getCachedImage(Budgeted budgeted) { | 98 SkImage* SkSurface_Base::getCachedImage(Budgeted budgeted) { |
95 if (NULL == fCachedImage) { | 99 if (NULL == fCachedImage) { |
96 fCachedImage = this->onNewImageSnapshot(budgeted); | 100 fCachedImage = this->onNewImageSnapshot(budgeted); |
97 SkASSERT(!fCachedCanvas || fCachedCanvas->getSurfaceBase() == this); | 101 SkASSERT(!fCachedCanvas || fCachedCanvas->getSurfaceBase() == this); |
98 } | 102 } |
99 return fCachedImage; | 103 return fCachedImage; |
100 } | 104 } |
101 | 105 |
102 #endif | 106 #endif |
OLD | NEW |