OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkConfig8888.h" | 9 #include "SkConfig8888.h" |
10 #include "SkDeviceProperties.h" | 10 #include "SkDeviceProperties.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 return SkNEW_ARGS(SkBitmapDevice, (bitmap, *props)); | 96 return SkNEW_ARGS(SkBitmapDevice, (bitmap, *props)); |
97 } else { | 97 } else { |
98 return SkNEW_ARGS(SkBitmapDevice, (bitmap)); | 98 return SkNEW_ARGS(SkBitmapDevice, (bitmap)); |
99 } | 99 } |
100 } | 100 } |
101 | 101 |
102 SkImageInfo SkBitmapDevice::imageInfo() const { | 102 SkImageInfo SkBitmapDevice::imageInfo() const { |
103 return fBitmap.info(); | 103 return fBitmap.info(); |
104 } | 104 } |
105 | 105 |
| 106 void SkBitmapDevice::setNewSize(const SkISize& size) { |
| 107 SkASSERT(!fBitmap.pixelRef()); |
| 108 fBitmap.setInfo(fBitmap.info().makeWH(size.fWidth, size.fHeight)); |
| 109 } |
| 110 |
106 void SkBitmapDevice::replaceBitmapBackendForRasterSurface(const SkBitmap& bm) { | 111 void SkBitmapDevice::replaceBitmapBackendForRasterSurface(const SkBitmap& bm) { |
107 SkASSERT(bm.width() == fBitmap.width()); | 112 SkASSERT(bm.width() == fBitmap.width()); |
108 SkASSERT(bm.height() == fBitmap.height()); | 113 SkASSERT(bm.height() == fBitmap.height()); |
109 fBitmap = bm; // intent is to use bm's pixelRef (and rowbytes/config) | 114 fBitmap = bm; // intent is to use bm's pixelRef (and rowbytes/config) |
110 fBitmap.lockPixels(); | 115 fBitmap.lockPixels(); |
111 } | 116 } |
112 | 117 |
113 SkBaseDevice* SkBitmapDevice::onCreateDevice(const CreateInfo& cinfo, const SkPa
int*) { | 118 SkBaseDevice* SkBitmapDevice::onCreateDevice(const CreateInfo& cinfo, const SkPa
int*) { |
114 SkDeviceProperties leaky(cinfo.fPixelGeometry); | 119 SkDeviceProperties leaky(cinfo.fPixelGeometry); |
115 return SkBitmapDevice::Create(cinfo.fInfo, &leaky); | 120 return SkBitmapDevice::Create(cinfo.fInfo, &leaky); |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 paint.getRasterizer() || | 381 paint.getRasterizer() || |
377 paint.getPathEffect() || | 382 paint.getPathEffect() || |
378 paint.isFakeBoldText() || | 383 paint.isFakeBoldText() || |
379 paint.getStyle() != SkPaint::kFill_Style || | 384 paint.getStyle() != SkPaint::kFill_Style || |
380 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) | 385 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) |
381 { | 386 { |
382 return true; | 387 return true; |
383 } | 388 } |
384 return false; | 389 return false; |
385 } | 390 } |
OLD | NEW |