OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2008 The Android Open Source Project | 3 * Copyright 2008 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1107 return; // failure, fAddr is NULL | 1107 return; // failure, fAddr is NULL |
1108 } | 1108 } |
1109 fAddr = fBitmap.getPixels(); | 1109 fAddr = fBitmap.getPixels(); |
1110 fRowBytes = fBitmap.rowBytes(); | 1110 fRowBytes = fBitmap.rowBytes(); |
1111 } | 1111 } |
1112 SkASSERT(fAddr); // success | 1112 SkASSERT(fAddr); // success |
1113 } | 1113 } |
1114 | 1114 |
1115 bool SkAutoROCanvasPixels::asROBitmap(SkBitmap* bitmap) const { | 1115 bool SkAutoROCanvasPixels::asROBitmap(SkBitmap* bitmap) const { |
1116 if (fAddr) { | 1116 if (fAddr) { |
1117 return bitmap->installPixels(fInfo, const_cast<void*>(fAddr), fRowBytes, | 1117 return bitmap->installPixels(fInfo, const_cast<void*>(fAddr), fRowBytes)
; |
1118 NULL, NULL); | |
1119 } else { | 1118 } else { |
1120 bitmap->reset(); | 1119 bitmap->reset(); |
1121 return false; | 1120 return false; |
1122 } | 1121 } |
1123 } | 1122 } |
1124 | 1123 |
1125 void SkCanvas::onPushCull(const SkRect& cullRect) { | 1124 void SkCanvas::onPushCull(const SkRect& cullRect) { |
1126 // do nothing. Subclasses may do something | 1125 // do nothing. Subclasses may do something |
1127 } | 1126 } |
1128 | 1127 |
(...skipping 1498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2627 if (!supported_for_raster_canvas(info)) { | 2626 if (!supported_for_raster_canvas(info)) { |
2628 return NULL; | 2627 return NULL; |
2629 } | 2628 } |
2630 | 2629 |
2631 SkBitmap bitmap; | 2630 SkBitmap bitmap; |
2632 if (!bitmap.installPixels(info, pixels, rowBytes)) { | 2631 if (!bitmap.installPixels(info, pixels, rowBytes)) { |
2633 return NULL; | 2632 return NULL; |
2634 } | 2633 } |
2635 return SkNEW_ARGS(SkCanvas, (bitmap)); | 2634 return SkNEW_ARGS(SkCanvas, (bitmap)); |
2636 } | 2635 } |
OLD | NEW |