| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "GrContext.h" | 8 #include "GrContext.h" |
| 9 #include "GrLayerCache.h" | 9 #include "GrLayerCache.h" |
| 10 #include "GrRecordReplaceDraw.h" | 10 #include "GrRecordReplaceDraw.h" |
| 11 #include "SkBigPicture.h" | 11 #include "SkBigPicture.h" |
| 12 #include "SkCanvasPriv.h" | 12 #include "SkCanvasPriv.h" |
| 13 #include "SkGrPixelRef.h" | 13 #include "SkGrPixelRef.h" |
| 14 #include "SkImage.h" | 14 #include "SkImage.h" |
| 15 #include "SkRecordDraw.h" | 15 #include "SkRecordDraw.h" |
| 16 #include "SkRecords.h" | 16 #include "SkRecords.h" |
| 17 | 17 |
| 18 static inline void wrap_texture(GrTexture* texture, int width, int height, SkBit
map* result) { | 18 static inline void wrap_texture(GrTexture* texture, int width, int height, SkBit
map* result) { |
| 19 SkImageInfo info = SkImageInfo::MakeN32Premul(width, height); | 19 SkImageInfo info = SkImageInfo::MakeN32Premul(width, height); |
| 20 result->setInfo(info); | 20 result->setInfo(info); |
| 21 result->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, texture)))->unref(); | 21 result->setPixelRef(new SkGrPixelRef(info, texture))->unref(); |
| 22 } | 22 } |
| 23 | 23 |
| 24 static inline void draw_replacement_bitmap(GrCachedLayer* layer, SkCanvas* canva
s) { | 24 static inline void draw_replacement_bitmap(GrCachedLayer* layer, SkCanvas* canva
s) { |
| 25 | 25 |
| 26 // Some image filter can totally filter away a layer (e.g., SkPictureImageFi
lter's with | 26 // Some image filter can totally filter away a layer (e.g., SkPictureImageFi
lter's with |
| 27 // no picture). | 27 // no picture). |
| 28 if (!layer->texture()) { | 28 if (!layer->texture()) { |
| 29 return; | 29 return; |
| 30 } | 30 } |
| 31 | 31 |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 ReplaceDraw draw(canvas, layerCache, NULL, 0, | 221 ReplaceDraw draw(canvas, layerCache, NULL, 0, |
| 222 bp, bp, | 222 bp, bp, |
| 223 initialMatrix, callback, NULL, 0); | 223 initialMatrix, callback, NULL, 0); |
| 224 return draw.draw(); | 224 return draw.draw(); |
| 225 } else { | 225 } else { |
| 226 // TODO: can we assume / assert this doesn't happen? | 226 // TODO: can we assume / assert this doesn't happen? |
| 227 picture->playback(canvas, callback); | 227 picture->playback(canvas, callback); |
| 228 return 0; | 228 return 0; |
| 229 } | 229 } |
| 230 } | 230 } |
| OLD | NEW |