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 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1055 | 1055 |
1056 const void* SkCanvas::peekPixels(SkImageInfo* info, size_t* rowBytes) { | 1056 const void* SkCanvas::peekPixels(SkImageInfo* info, size_t* rowBytes) { |
1057 return this->onPeekPixels(info, rowBytes); | 1057 return this->onPeekPixels(info, rowBytes); |
1058 } | 1058 } |
1059 | 1059 |
1060 const void* SkCanvas::onPeekPixels(SkImageInfo* info, size_t* rowBytes) { | 1060 const void* SkCanvas::onPeekPixels(SkImageInfo* info, size_t* rowBytes) { |
1061 SkBaseDevice* dev = this->getDevice(); | 1061 SkBaseDevice* dev = this->getDevice(); |
1062 return dev ? dev->peekPixels(info, rowBytes) : NULL; | 1062 return dev ? dev->peekPixels(info, rowBytes) : NULL; |
1063 } | 1063 } |
1064 | 1064 |
1065 void* SkCanvas::accessTopLayerPixels(SkImageInfo* info, size_t* rowBytes) { | |
1066 return const_cast<void*>(this->onPeekPixels(info, rowBytes)); | |
bsalomon
2014/03/12 14:43:11
onAccessTopLayerPixels()
reed1
2014/03/12 15:31:59
Done.
| |
1067 } | |
1068 | |
1069 void* SkCanvas::onAccessTopLayerPixels(SkImageInfo* info, size_t* rowBytes) { | |
1070 SkBaseDevice* dev = this->getTopDevice(); | |
1071 return dev ? dev->accessPixels(info, rowBytes) : NULL; | |
1072 } | |
1073 | |
1065 SkAutoROCanvasPixels::SkAutoROCanvasPixels(SkCanvas* canvas) { | 1074 SkAutoROCanvasPixels::SkAutoROCanvasPixels(SkCanvas* canvas) { |
1066 fAddr = canvas->peekPixels(&fInfo, &fRowBytes); | 1075 fAddr = canvas->peekPixels(&fInfo, &fRowBytes); |
1067 if (NULL == fAddr) { | 1076 if (NULL == fAddr) { |
1068 fInfo = canvas->imageInfo(); | 1077 fInfo = canvas->imageInfo(); |
1069 if (kUnknown_SkColorType == fInfo.colorType() || | 1078 if (kUnknown_SkColorType == fInfo.colorType() || |
1070 !fBitmap.allocPixels(fInfo)) | 1079 !fBitmap.allocPixels(fInfo)) |
1071 { | 1080 { |
1072 return; // failure, fAddr is NULL | 1081 return; // failure, fAddr is NULL |
1073 } | 1082 } |
1074 fBitmap.lockPixels(); | 1083 fBitmap.lockPixels(); |
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1728 void SkCanvas::internal_private_getTotalClipAsPath(SkPath* path) const { | 1737 void SkCanvas::internal_private_getTotalClipAsPath(SkPath* path) const { |
1729 path->reset(); | 1738 path->reset(); |
1730 | 1739 |
1731 const SkRegion& rgn = fMCRec->fRasterClip->forceGetBW(); | 1740 const SkRegion& rgn = fMCRec->fRasterClip->forceGetBW(); |
1732 if (rgn.isEmpty()) { | 1741 if (rgn.isEmpty()) { |
1733 return; | 1742 return; |
1734 } | 1743 } |
1735 (void)rgn.getBoundaryPath(path); | 1744 (void)rgn.getBoundaryPath(path); |
1736 } | 1745 } |
1737 | 1746 |
1747 GrRenderTarget* SkCanvas::internal_private_accessTopLayerRenderTarget() { | |
1748 SkBaseDevice* dev = this->getTopDevice(); | |
1749 return dev ? dev->accessRenderTarget() : NULL; | |
1750 } | |
1751 | |
1738 SkBaseDevice* SkCanvas::createLayerDevice(const SkImageInfo& info) { | 1752 SkBaseDevice* SkCanvas::createLayerDevice(const SkImageInfo& info) { |
1739 SkBaseDevice* device = this->getTopDevice(); | 1753 SkBaseDevice* device = this->getTopDevice(); |
1740 return device ? device->createCompatibleDeviceForSaveLayer(info) : NULL; | 1754 return device ? device->createCompatibleDeviceForSaveLayer(info) : NULL; |
1741 } | 1755 } |
1742 | 1756 |
1743 GrContext* SkCanvas::getGrContext() { | 1757 GrContext* SkCanvas::getGrContext() { |
1744 #if SK_SUPPORT_GPU | 1758 #if SK_SUPPORT_GPU |
1745 SkBaseDevice* device = this->getTopDevice(); | 1759 SkBaseDevice* device = this->getTopDevice(); |
1746 if (NULL != device) { | 1760 if (NULL != device) { |
1747 GrRenderTarget* renderTarget = device->accessRenderTarget(); | 1761 GrRenderTarget* renderTarget = device->accessRenderTarget(); |
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2485 if (!bitmap.allocPixels(info)) { | 2499 if (!bitmap.allocPixels(info)) { |
2486 return NULL; | 2500 return NULL; |
2487 } | 2501 } |
2488 | 2502 |
2489 // should this functionality be moved into allocPixels()? | 2503 // should this functionality be moved into allocPixels()? |
2490 if (!bitmap.info().isOpaque()) { | 2504 if (!bitmap.info().isOpaque()) { |
2491 bitmap.eraseColor(0); | 2505 bitmap.eraseColor(0); |
2492 } | 2506 } |
2493 return SkNEW_ARGS(SkCanvas, (bitmap)); | 2507 return SkNEW_ARGS(SkCanvas, (bitmap)); |
2494 } | 2508 } |
OLD | NEW |