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 | |
111 void SkBitmapDevice::replaceBitmapBackendForRasterSurface(const SkBitmap& bm) { | 106 void SkBitmapDevice::replaceBitmapBackendForRasterSurface(const SkBitmap& bm) { |
112 SkASSERT(bm.width() == fBitmap.width()); | 107 SkASSERT(bm.width() == fBitmap.width()); |
113 SkASSERT(bm.height() == fBitmap.height()); | 108 SkASSERT(bm.height() == fBitmap.height()); |
114 fBitmap = bm; // intent is to use bm's pixelRef (and rowbytes/config) | 109 fBitmap = bm; // intent is to use bm's pixelRef (and rowbytes/config) |
115 fBitmap.lockPixels(); | 110 fBitmap.lockPixels(); |
116 } | 111 } |
117 | 112 |
118 SkBaseDevice* SkBitmapDevice::onCreateDevice(const CreateInfo& cinfo, const SkPa
int*) { | 113 SkBaseDevice* SkBitmapDevice::onCreateDevice(const CreateInfo& cinfo, const SkPa
int*) { |
119 SkDeviceProperties leaky(cinfo.fPixelGeometry); | 114 SkDeviceProperties leaky(cinfo.fPixelGeometry); |
120 return SkBitmapDevice::Create(cinfo.fInfo, &leaky); | 115 return SkBitmapDevice::Create(cinfo.fInfo, &leaky); |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 paint.getRasterizer() || | 376 paint.getRasterizer() || |
382 paint.getPathEffect() || | 377 paint.getPathEffect() || |
383 paint.isFakeBoldText() || | 378 paint.isFakeBoldText() || |
384 paint.getStyle() != SkPaint::kFill_Style || | 379 paint.getStyle() != SkPaint::kFill_Style || |
385 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) | 380 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) |
386 { | 381 { |
387 return true; | 382 return true; |
388 } | 383 } |
389 return false; | 384 return false; |
390 } | 385 } |
OLD | NEW |