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 "SkImagePriv.h" | 9 #include "SkImagePriv.h" |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 } | 93 } |
94 | 94 |
95 SkImage_Raster::SkImage_Raster(const Info& info, SkPixelRef* pr, size_t rowBytes
) | 95 SkImage_Raster::SkImage_Raster(const Info& info, SkPixelRef* pr, size_t rowBytes
) |
96 : INHERITED(info.fWidth, info.fHeight) { | 96 : INHERITED(info.fWidth, info.fHeight) { |
97 bool isOpaque; | 97 bool isOpaque; |
98 SkBitmap::Config config = SkImageInfoToBitmapConfig(info, &isOpaque); | 98 SkBitmap::Config config = SkImageInfoToBitmapConfig(info, &isOpaque); |
99 | 99 |
100 fBitmap.setConfig(config, info.fWidth, info.fHeight, rowBytes); | 100 fBitmap.setConfig(config, info.fWidth, info.fHeight, rowBytes); |
101 fBitmap.setPixelRef(pr); | 101 fBitmap.setPixelRef(pr); |
102 fBitmap.setIsOpaque(isOpaque); | 102 fBitmap.setIsOpaque(isOpaque); |
103 fBitmap.setImmutable(); | |
104 } | 103 } |
105 | 104 |
106 SkImage_Raster::~SkImage_Raster() {} | 105 SkImage_Raster::~SkImage_Raster() {} |
107 | 106 |
108 void SkImage_Raster::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPa
int* paint) { | 107 void SkImage_Raster::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPa
int* paint) { |
109 canvas->drawBitmap(fBitmap, x, y, paint); | 108 canvas->drawBitmap(fBitmap, x, y, paint); |
110 } | 109 } |
111 | 110 |
112 /////////////////////////////////////////////////////////////////////////////// | 111 /////////////////////////////////////////////////////////////////////////////// |
113 | 112 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 } | 151 } |
153 | 152 |
154 SkImage* SkNewImageFromPixelRef(const SkImage::Info& info, SkPixelRef* pr, | 153 SkImage* SkNewImageFromPixelRef(const SkImage::Info& info, SkPixelRef* pr, |
155 size_t rowBytes) { | 154 size_t rowBytes) { |
156 return SkNEW_ARGS(SkImage_Raster, (info, pr, rowBytes)); | 155 return SkNEW_ARGS(SkImage_Raster, (info, pr, rowBytes)); |
157 } | 156 } |
158 | 157 |
159 SkPixelRef* SkBitmapImageGetPixelRef(SkImage* image) { | 158 SkPixelRef* SkBitmapImageGetPixelRef(SkImage* image) { |
160 return ((SkImage_Raster*)image)->getPixelRef(); | 159 return ((SkImage_Raster*)image)->getPixelRef(); |
161 } | 160 } |
OLD | NEW |