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 "SkSurface.h" | 11 #include "SkSurface.h" |
12 #include "SkCanvas.h" | 12 #include "SkCanvas.h" |
13 | 13 |
14 class SkSurface_Base : public SkSurface { | 14 class SkSurface_Base : public SkSurface { |
15 public: | 15 public: |
16 SkSurface_Base(int width, int height); | 16 SkSurface_Base(int width, int height); |
17 virtual ~SkSurface_Base(); | 17 virtual ~SkSurface_Base(); |
18 | 18 |
19 /** | 19 /** |
20 * Allocate a canvas that will draw into this surface. We will cache this | 20 * Allocate a canvas that will draw into this surface. We will cache this |
21 * canvas, to return the same object to the caller multiple times. We | 21 * canvas, to return the same object to the caller multiple times. We |
22 * take ownership, and will call unref() on the canvas when we go out of | 22 * take ownership, and will call unref() on the canvas when we go out of |
23 * scope. | 23 * scope. |
24 */ | 24 */ |
25 virtual SkCanvas* onNewCanvas() = 0; | 25 virtual SkCanvas* onNewCanvas() = 0; |
26 | 26 |
27 virtual SkSurface* onNewSurface(const SkImage::Info&) = 0; | 27 virtual SkSurface* onNewSurface(const SkImageInfo&) = 0; |
28 | 28 |
29 /** | 29 /** |
30 * Allocate an SkImage that represents the current contents of the surface. | 30 * Allocate an SkImage that represents the current contents of the surface. |
31 * This needs to be able to outlive the surface itself (if need be), and | 31 * This needs to be able to outlive the surface itself (if need be), and |
32 * must faithfully represent the current contents, even if the surface | 32 * must faithfully represent the current contents, even if the surface |
33 * is chaged after this calle (e.g. it is drawn to via its canvas). | 33 * is chaged after this calle (e.g. it is drawn to via its canvas). |
34 */ | 34 */ |
35 virtual SkImage* onNewImageSnapshot() = 0; | 35 virtual SkImage* onNewImageSnapshot() = 0; |
36 | 36 |
37 /** | 37 /** |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 return fCachedImage; | 87 return fCachedImage; |
88 } | 88 } |
89 | 89 |
90 void SkSurface_Base::installIntoCanvasForDirtyNotification() { | 90 void SkSurface_Base::installIntoCanvasForDirtyNotification() { |
91 if (NULL != fCachedCanvas) { | 91 if (NULL != fCachedCanvas) { |
92 fCachedCanvas->setSurfaceBase(this); | 92 fCachedCanvas->setSurfaceBase(this); |
93 } | 93 } |
94 } | 94 } |
95 | 95 |
96 #endif | 96 #endif |
OLD | NEW |