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 #include "SkSurface_Base.h" | 8 #include "SkSurface_Base.h" |
9 #include "SkImagePriv.h" | 9 #include "SkImagePriv.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
11 #include "SkDevice.h" | 11 #include "SkDevice.h" |
12 #include "SkMallocPixelRef.h" | 12 #include "SkMallocPixelRef.h" |
13 | 13 |
14 static const size_t kIgnoreRowBytesValue = (size_t)~0; | 14 static const size_t kIgnoreRowBytesValue = (size_t)~0; |
15 | 15 |
16 class SkSurface_Raster : public SkSurface_Base { | 16 class SkSurface_Raster : public SkSurface_Base { |
17 public: | 17 public: |
18 static bool Valid(const SkImageInfo&, size_t rb = kIgnoreRowBytesValue); | 18 static bool Valid(const SkImageInfo&, size_t rb = kIgnoreRowBytesValue); |
19 | 19 |
20 SkSurface_Raster(const SkImageInfo&, void*, size_t rb, | 20 SkSurface_Raster(const SkImageInfo&, void*, size_t rb, |
21 void (*releaseProc)(void* pixels, void* context), void* con
text, | 21 void (*releaseProc)(void* pixels, void* context), void* con
text, |
22 const SkSurfaceProps*); | 22 const SkSurfaceProps*); |
23 SkSurface_Raster(SkPixelRef*, const SkSurfaceProps*); | 23 SkSurface_Raster(SkPixelRef*, const SkSurfaceProps*); |
24 | 24 |
25 SkCanvas* onNewCanvas() SK_OVERRIDE; | 25 SkCanvas* onNewCanvas() override; |
26 SkSurface* onNewSurface(const SkImageInfo&) SK_OVERRIDE; | 26 SkSurface* onNewSurface(const SkImageInfo&) override; |
27 SkImage* onNewImageSnapshot(Budgeted) SK_OVERRIDE; | 27 SkImage* onNewImageSnapshot(Budgeted) override; |
28 virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, | 28 virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, |
29 const SkPaint*) SK_OVERRIDE; | 29 const SkPaint*) override; |
30 void onCopyOnWrite(ContentChangeMode) SK_OVERRIDE; | 30 void onCopyOnWrite(ContentChangeMode) override; |
31 | 31 |
32 private: | 32 private: |
33 SkBitmap fBitmap; | 33 SkBitmap fBitmap; |
34 bool fWeOwnThePixels; | 34 bool fWeOwnThePixels; |
35 | 35 |
36 typedef SkSurface_Base INHERITED; | 36 typedef SkSurface_Base INHERITED; |
37 }; | 37 }; |
38 | 38 |
39 /////////////////////////////////////////////////////////////////////////////// | 39 /////////////////////////////////////////////////////////////////////////////// |
40 | 40 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 if (!SkSurface_Raster::Valid(info)) { | 169 if (!SkSurface_Raster::Valid(info)) { |
170 return NULL; | 170 return NULL; |
171 } | 171 } |
172 | 172 |
173 SkAutoTUnref<SkPixelRef> pr(SkMallocPixelRef::NewAllocate(info, 0, NULL)); | 173 SkAutoTUnref<SkPixelRef> pr(SkMallocPixelRef::NewAllocate(info, 0, NULL)); |
174 if (NULL == pr.get()) { | 174 if (NULL == pr.get()) { |
175 return NULL; | 175 return NULL; |
176 } | 176 } |
177 return SkNEW_ARGS(SkSurface_Raster, (pr, props)); | 177 return SkNEW_ARGS(SkSurface_Raster, (pr, props)); |
178 } | 178 } |
OLD | NEW |