| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 #endif | 283 #endif |
| 284 }; | 284 }; |
| 285 | 285 |
| 286 #include "SkMallocPixelRef.h" | 286 #include "SkMallocPixelRef.h" |
| 287 | 287 |
| 288 // This is a tricky pattern, because we have to setConfig+rowBytes AND specify | 288 // This is a tricky pattern, because we have to setConfig+rowBytes AND specify |
| 289 // a custom pixelRef (which also has to specify its rowBytes), so we have to be | 289 // a custom pixelRef (which also has to specify its rowBytes), so we have to be |
| 290 // sure that the two rowBytes match (and the infos match). | 290 // sure that the two rowBytes match (and the infos match). |
| 291 // | 291 // |
| 292 static bool allocRowBytes(SkBitmap* bm, const SkImageInfo& info, size_t rowBytes
) { | 292 static bool allocRowBytes(SkBitmap* bm, const SkImageInfo& info, size_t rowBytes
) { |
| 293 if (!bm->setInfo(info, rowBytes)) { | 293 if (!bm->setConfig(info, rowBytes)) { |
| 294 return false; | 294 return false; |
| 295 } | 295 } |
| 296 SkPixelRef* pr = SkMallocPixelRef::NewAllocate(info, rowBytes, NULL); | 296 SkPixelRef* pr = SkMallocPixelRef::NewAllocate(info, rowBytes, NULL); |
| 297 bm->setPixelRef(pr)->unref(); | 297 bm->setPixelRef(pr)->unref(); |
| 298 return true; | 298 return true; |
| 299 } | 299 } |
| 300 | 300 |
| 301 static SkBaseDevice* createDevice(const CanvasConfig& c, GrContext* grCtx) { | 301 static SkBaseDevice* createDevice(const CanvasConfig& c, GrContext* grCtx) { |
| 302 switch (c.fDevType) { | 302 switch (c.fDevType) { |
| 303 case kRaster_DevType: { | 303 case kRaster_DevType: { |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 SkIRect writeRect = SkIRect::MakeXYWH(rect.fLeft, rect.f
Top, | 462 SkIRect writeRect = SkIRect::MakeXYWH(rect.fLeft, rect.f
Top, |
| 463 bmp.width(), bmp.h
eight()); | 463 bmp.width(), bmp.h
eight()); |
| 464 bool intersects = SkIRect::Intersects(canvasRect, writeR
ect) ; | 464 bool intersects = SkIRect::Intersects(canvasRect, writeR
ect) ; |
| 465 REPORTER_ASSERT(reporter, intersects == (idBefore != idA
fter)); | 465 REPORTER_ASSERT(reporter, intersects == (idBefore != idA
fter)); |
| 466 } | 466 } |
| 467 } | 467 } |
| 468 } | 468 } |
| 469 } | 469 } |
| 470 } | 470 } |
| 471 } | 471 } |
| OLD | NEW |