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 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 } | 660 } |
661 // now jam our 1st clip to be bounds, and intersect the rest with that | 661 // now jam our 1st clip to be bounds, and intersect the rest with that |
662 rec->fRasterClip->setRect(bounds); | 662 rec->fRasterClip->setRect(bounds); |
663 while ((rec = (MCRec*)iter.next()) != NULL) { | 663 while ((rec = (MCRec*)iter.next()) != NULL) { |
664 (void)rec->fRasterClip->op(bounds, SkRegion::kIntersect_Op); | 664 (void)rec->fRasterClip->op(bounds, SkRegion::kIntersect_Op); |
665 } | 665 } |
666 | 666 |
667 return device; | 667 return device; |
668 } | 668 } |
669 | 669 |
670 #ifdef SK_SUPPORT_LEGACY_READPIXELSCONFIG | |
671 bool SkCanvas::readPixels(SkBitmap* bitmap, | |
672 int x, int y, | |
673 Config8888 config8888) { | |
674 SkBaseDevice* device = this->getDevice(); | |
675 if (!device) { | |
676 return false; | |
677 } | |
678 return device->readPixels(bitmap, x, y, config8888); | |
679 } | |
680 #endif | |
681 | |
682 bool SkCanvas::readPixels(SkBitmap* bitmap, int x, int y) { | 670 bool SkCanvas::readPixels(SkBitmap* bitmap, int x, int y) { |
683 if (kUnknown_SkColorType == bitmap->colorType() || bitmap->getTexture()) { | 671 if (kUnknown_SkColorType == bitmap->colorType() || bitmap->getTexture()) { |
684 return false; | 672 return false; |
685 } | 673 } |
686 | 674 |
687 bool weAllocated = false; | 675 bool weAllocated = false; |
688 if (NULL == bitmap->pixelRef()) { | 676 if (NULL == bitmap->pixelRef()) { |
689 if (!bitmap->allocPixels()) { | 677 if (!bitmap->allocPixels()) { |
690 return false; | 678 return false; |
691 } | 679 } |
(...skipping 1982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2674 if (!bitmap.installPixels(info, pixels, rowBytes)) { | 2662 if (!bitmap.installPixels(info, pixels, rowBytes)) { |
2675 return NULL; | 2663 return NULL; |
2676 } | 2664 } |
2677 | 2665 |
2678 // should this functionality be moved into allocPixels()? | 2666 // should this functionality be moved into allocPixels()? |
2679 if (!bitmap.info().isOpaque()) { | 2667 if (!bitmap.info().isOpaque()) { |
2680 bitmap.eraseColor(0); | 2668 bitmap.eraseColor(0); |
2681 } | 2669 } |
2682 return SkNEW_ARGS(SkCanvas, (bitmap)); | 2670 return SkNEW_ARGS(SkCanvas, (bitmap)); |
2683 } | 2671 } |
OLD | NEW |