| 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 static Props MakeDefaultProps(); |
| 17 explicit SkSurface_Base(const SkImageInfo&); | 17 |
| 18 SkSurface_Base(int width, int height, const Props&); |
| 19 SkSurface_Base(const SkImageInfo&, const Props&); |
| 18 virtual ~SkSurface_Base(); | 20 virtual ~SkSurface_Base(); |
| 19 | 21 |
| 20 /** | 22 /** |
| 21 * Allocate a canvas that will draw into this surface. We will cache this | 23 * Allocate a canvas that will draw into this surface. We will cache this |
| 22 * canvas, to return the same object to the caller multiple times. We | 24 * canvas, to return the same object to the caller multiple times. We |
| 23 * take ownership, and will call unref() on the canvas when we go out of | 25 * take ownership, and will call unref() on the canvas when we go out of |
| 24 * scope. | 26 * scope. |
| 25 */ | 27 */ |
| 26 virtual SkCanvas* onNewCanvas() = 0; | 28 virtual SkCanvas* onNewCanvas() = 0; |
| 27 | 29 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 90 |
| 89 SkImage* SkSurface_Base::getCachedImage() { | 91 SkImage* SkSurface_Base::getCachedImage() { |
| 90 if (NULL == fCachedImage) { | 92 if (NULL == fCachedImage) { |
| 91 fCachedImage = this->onNewImageSnapshot(); | 93 fCachedImage = this->onNewImageSnapshot(); |
| 92 SkASSERT(!fCachedCanvas || fCachedCanvas->getSurfaceBase() == this); | 94 SkASSERT(!fCachedCanvas || fCachedCanvas->getSurfaceBase() == this); |
| 93 } | 95 } |
| 94 return fCachedImage; | 96 return fCachedImage; |
| 95 } | 97 } |
| 96 | 98 |
| 97 #endif | 99 #endif |
| OLD | NEW |