| 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 "SkBitmapDevice.h" | 8 #include "SkBitmapDevice.h" |
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkData.h" | 10 #include "SkData.h" |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 virtual bool onReadPixels(const SkBitmap& bitmap, | 165 virtual bool onReadPixels(const SkBitmap& bitmap, |
| 166 int x, int y, | 166 int x, int y, |
| 167 SkCanvas::Config8888 config8888) SK_OVERRIDE { | 167 SkCanvas::Config8888 config8888) SK_OVERRIDE { |
| 168 not_supported(); | 168 not_supported(); |
| 169 return false; | 169 return false; |
| 170 } | 170 } |
| 171 | 171 |
| 172 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) SK_OVERRI
DE { | 172 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) SK_OVERRI
DE { |
| 173 not_supported(); | 173 not_supported(); |
| 174 } | 174 } |
| 175 virtual SkBaseDevice* onCreateCompatibleDevice(SkBitmap::Config config, | 175 virtual SkBaseDevice* onCreateDevice(const SkImageInfo& info, Usage usage) S
K_OVERRIDE { |
| 176 int width, int height, | |
| 177 bool isOpaque, | |
| 178 Usage usage) SK_OVERRIDE { | |
| 179 // we expect to only get called via savelayer, in which case it is fine. | 176 // we expect to only get called via savelayer, in which case it is fine. |
| 180 SkASSERT(kSaveLayer_Usage == usage); | 177 SkASSERT(kSaveLayer_Usage == usage); |
| 181 return SkNEW_ARGS(GatherPixelRefDevice, (width, height, fPRSet)); | 178 return SkNEW_ARGS(GatherPixelRefDevice, (info.width(), info.height(), fP
RSet)); |
| 182 } | 179 } |
| 183 virtual void flush() SK_OVERRIDE {} | 180 virtual void flush() SK_OVERRIDE {} |
| 184 | 181 |
| 185 private: | 182 private: |
| 186 PixelRefSet* fPRSet; | 183 PixelRefSet* fPRSet; |
| 187 SkBitmap fEmptyBitmap; // legacy -- need to remove the need for this guy | 184 SkBitmap fEmptyBitmap; // legacy -- need to remove the need for this guy |
| 188 SkISize fSize; | 185 SkISize fSize; |
| 189 | 186 |
| 190 void addBitmap(const SkBitmap& bm) { | 187 void addBitmap(const SkBitmap& bm) { |
| 191 fPRSet->add(bm.pixelRef()); | 188 fPRSet->add(bm.pixelRef()); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 canvas.clipRect(area, SkRegion::kIntersect_Op, false); | 226 canvas.clipRect(area, SkRegion::kIntersect_Op, false); |
| 230 canvas.drawPicture(*pict); | 227 canvas.drawPicture(*pict); |
| 231 | 228 |
| 232 SkData* data = NULL; | 229 SkData* data = NULL; |
| 233 int count = array.count(); | 230 int count = array.count(); |
| 234 if (count > 0) { | 231 if (count > 0) { |
| 235 data = SkData::NewFromMalloc(array.detach(), count * sizeof(SkPixelRef*)
); | 232 data = SkData::NewFromMalloc(array.detach(), count * sizeof(SkPixelRef*)
); |
| 236 } | 233 } |
| 237 return data; | 234 return data; |
| 238 } | 235 } |
| OLD | NEW |