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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 | 511 |
512 this->init(NULL); | 512 this->init(NULL); |
513 } | 513 } |
514 | 514 |
515 SkCanvas::SkCanvas(int width, int height) | 515 SkCanvas::SkCanvas(int width, int height) |
516 : fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage)) | 516 : fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage)) |
517 { | 517 { |
518 inc_canvas(); | 518 inc_canvas(); |
519 | 519 |
520 SkBitmap bitmap; | 520 SkBitmap bitmap; |
521 bitmap.setConfig(SkBitmap::kNo_Config, width, height); | 521 bitmap.setConfig(SkImageInfo::MakeUnknown(width, height)); |
522 this->init(SkNEW_ARGS(SkBitmapDevice, (bitmap)))->unref(); | 522 this->init(SkNEW_ARGS(SkBitmapDevice, (bitmap)))->unref(); |
523 } | 523 } |
524 | 524 |
525 SkCanvas::SkCanvas(SkBaseDevice* device) | 525 SkCanvas::SkCanvas(SkBaseDevice* device) |
526 : fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage)) | 526 : fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage)) |
527 { | 527 { |
528 inc_canvas(); | 528 inc_canvas(); |
529 | 529 |
530 this->init(device); | 530 this->init(device); |
531 } | 531 } |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
943 SkSurface* SkCanvas::onNewSurface(const SkImageInfo& info) { | 943 SkSurface* SkCanvas::onNewSurface(const SkImageInfo& info) { |
944 SkBaseDevice* dev = this->getDevice(); | 944 SkBaseDevice* dev = this->getDevice(); |
945 return dev ? dev->newSurface(info) : NULL; | 945 return dev ? dev->newSurface(info) : NULL; |
946 } | 946 } |
947 | 947 |
948 SkImageInfo SkCanvas::imageInfo() const { | 948 SkImageInfo SkCanvas::imageInfo() const { |
949 SkBaseDevice* dev = this->getDevice(); | 949 SkBaseDevice* dev = this->getDevice(); |
950 if (dev) { | 950 if (dev) { |
951 return dev->imageInfo(); | 951 return dev->imageInfo(); |
952 } else { | 952 } else { |
953 // TODO: need a real unknown for alphatype it seems. | 953 return SkImageInfo::MakeUnknown(0, 0); |
954 SkAlphaType unknownAlphaType = kIgnore_SkAlphaType; | |
955 return SkImageInfo::Make(0, 0, kUnknown_SkColorType, unknownAlphaType); | |
956 } | 954 } |
957 } | 955 } |
958 | 956 |
959 const void* SkCanvas::peekPixels(SkImageInfo* info, size_t* rowBytes) { | 957 const void* SkCanvas::peekPixels(SkImageInfo* info, size_t* rowBytes) { |
960 return this->onPeekPixels(info, rowBytes); | 958 return this->onPeekPixels(info, rowBytes); |
961 } | 959 } |
962 | 960 |
963 const void* SkCanvas::onPeekPixels(SkImageInfo* info, size_t* rowBytes) { | 961 const void* SkCanvas::onPeekPixels(SkImageInfo* info, size_t* rowBytes) { |
964 SkBaseDevice* dev = this->getDevice(); | 962 SkBaseDevice* dev = this->getDevice(); |
965 return dev ? dev->peekPixels(info, rowBytes) : NULL; | 963 return dev ? dev->peekPixels(info, rowBytes) : NULL; |
(...skipping 1277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2243 return *paint; | 2241 return *paint; |
2244 } | 2242 } |
2245 | 2243 |
2246 const SkRegion& SkCanvas::LayerIter::clip() const { return fImpl->getClip(); } | 2244 const SkRegion& SkCanvas::LayerIter::clip() const { return fImpl->getClip(); } |
2247 int SkCanvas::LayerIter::x() const { return fImpl->getX(); } | 2245 int SkCanvas::LayerIter::x() const { return fImpl->getX(); } |
2248 int SkCanvas::LayerIter::y() const { return fImpl->getY(); } | 2246 int SkCanvas::LayerIter::y() const { return fImpl->getY(); } |
2249 | 2247 |
2250 /////////////////////////////////////////////////////////////////////////////// | 2248 /////////////////////////////////////////////////////////////////////////////// |
2251 | 2249 |
2252 SkCanvas::ClipVisitor::~ClipVisitor() { } | 2250 SkCanvas::ClipVisitor::~ClipVisitor() { } |
OLD | NEW |