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 "SkImage_Base.h" | 8 #include "SkImage_Base.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 int64_t size = (int64_t)info.height() * rowBytes; | 46 int64_t size = (int64_t)info.height() * rowBytes; |
47 if (size > (int64_t)kMaxPixelByteSize) { | 47 if (size > (int64_t)kMaxPixelByteSize) { |
48 return false; | 48 return false; |
49 } | 49 } |
50 return true; | 50 return true; |
51 } | 51 } |
52 | 52 |
53 SkImage_Raster(const SkImageInfo&, SkData*, size_t rb, const SkSurfaceProps*
); | 53 SkImage_Raster(const SkImageInfo&, SkData*, size_t rb, const SkSurfaceProps*
); |
54 virtual ~SkImage_Raster(); | 54 virtual ~SkImage_Raster(); |
55 | 55 |
56 void onDraw(SkCanvas*, SkScalar, SkScalar, const SkPaint*) const SK_OVERRIDE
; | 56 void onDraw(SkCanvas*, SkScalar, SkScalar, const SkPaint*) const override; |
57 void onDrawRect(SkCanvas*, const SkRect*, const SkRect&, const SkPaint*) con
st SK_OVERRIDE; | 57 void onDrawRect(SkCanvas*, const SkRect*, const SkRect&, const SkPaint*) con
st override; |
58 SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&) const SK_
OVERRIDE; | 58 SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&) const ove
rride; |
59 bool onReadPixels(const SkImageInfo&, void*, size_t, int srcX, int srcY) con
st SK_OVERRIDE; | 59 bool onReadPixels(const SkImageInfo&, void*, size_t, int srcX, int srcY) con
st override; |
60 const void* onPeekPixels(SkImageInfo*, size_t* /*rowBytes*/) const SK_OVERRI
DE; | 60 const void* onPeekPixels(SkImageInfo*, size_t* /*rowBytes*/) const override; |
61 bool getROPixels(SkBitmap*) const SK_OVERRIDE; | 61 bool getROPixels(SkBitmap*) const override; |
62 | 62 |
63 // exposed for SkSurface_Raster via SkNewImageFromPixelRef | 63 // exposed for SkSurface_Raster via SkNewImageFromPixelRef |
64 SkImage_Raster(const SkImageInfo&, SkPixelRef*, const SkIPoint& pixelRefOrig
in, size_t rowBytes, | 64 SkImage_Raster(const SkImageInfo&, SkPixelRef*, const SkIPoint& pixelRefOrig
in, size_t rowBytes, |
65 const SkSurfaceProps*); | 65 const SkSurfaceProps*); |
66 | 66 |
67 SkPixelRef* getPixelRef() const { return fBitmap.pixelRef(); } | 67 SkPixelRef* getPixelRef() const { return fBitmap.pixelRef(); } |
68 | 68 |
69 virtual SkShader* onNewShader(SkShader::TileMode, | 69 virtual SkShader* onNewShader(SkShader::TileMode, |
70 SkShader::TileMode, | 70 SkShader::TileMode, |
71 const SkMatrix* localMatrix) const SK_OVERRIDE
; | 71 const SkMatrix* localMatrix) const override; |
72 | 72 |
73 bool isOpaque() const SK_OVERRIDE; | 73 bool isOpaque() const override; |
74 | 74 |
75 SkImage_Raster(const SkBitmap& bm, const SkSurfaceProps* props) | 75 SkImage_Raster(const SkBitmap& bm, const SkSurfaceProps* props) |
76 : INHERITED(bm.width(), bm.height(), props) | 76 : INHERITED(bm.width(), bm.height(), props) |
77 , fBitmap(bm) {} | 77 , fBitmap(bm) {} |
78 | 78 |
79 private: | 79 private: |
80 SkImage_Raster() : INHERITED(0, 0, NULL) {} | 80 SkImage_Raster() : INHERITED(0, 0, NULL) {} |
81 | 81 |
82 SkBitmap fBitmap; | 82 SkBitmap fBitmap; |
83 | 83 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 } | 229 } |
230 | 230 |
231 const SkPixelRef* SkBitmapImageGetPixelRef(const SkImage* image) { | 231 const SkPixelRef* SkBitmapImageGetPixelRef(const SkImage* image) { |
232 return ((const SkImage_Raster*)image)->getPixelRef(); | 232 return ((const SkImage_Raster*)image)->getPixelRef(); |
233 } | 233 } |
234 | 234 |
235 bool SkImage_Raster::isOpaque() const { | 235 bool SkImage_Raster::isOpaque() const { |
236 return fBitmap.isOpaque(); | 236 return fBitmap.isOpaque(); |
237 } | 237 } |
238 | 238 |
OLD | NEW |