| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2008 The Android Open Source Project | 2 * Copyright 2008 The Android Open Source Project |
| 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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkCanvasPriv.h" | 10 #include "SkCanvasPriv.h" |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 }; | 312 }; |
| 313 | 313 |
| 314 static SkIRect compute_device_bounds(SkBaseDevice* device) { | 314 static SkIRect compute_device_bounds(SkBaseDevice* device) { |
| 315 return SkIRect::MakeXYWH(device->getOrigin().x(), device->getOrigin().y(), | 315 return SkIRect::MakeXYWH(device->getOrigin().x(), device->getOrigin().y(), |
| 316 device->width(), device->height()); | 316 device->width(), device->height()); |
| 317 } | 317 } |
| 318 | 318 |
| 319 class SkDrawIter : public SkDraw { | 319 class SkDrawIter : public SkDraw { |
| 320 public: | 320 public: |
| 321 SkDrawIter(SkCanvas* canvas) { | 321 SkDrawIter(SkCanvas* canvas) { |
| 322 canvas = canvas->canvasForDrawIter(); | |
| 323 canvas->updateDeviceCMCache(); | 322 canvas->updateDeviceCMCache(); |
| 324 | 323 |
| 325 fClipStack = canvas->fClipStack; | 324 fClipStack = canvas->getClipStack(); |
| 326 fCurrLayer = canvas->fMCRec->fTopLayer; | 325 fCurrLayer = canvas->fMCRec->fTopLayer; |
| 327 | 326 |
| 328 fMultiDeviceCS = nullptr; | 327 fMultiDeviceCS = nullptr; |
| 329 if (fCurrLayer->fNext) { | 328 if (fCurrLayer->fNext) { |
| 330 fMultiDeviceCS = canvas->fClipStack; | 329 fMultiDeviceCS = canvas->fClipStack.get(); |
| 331 fMultiDeviceCS->save(); | 330 fMultiDeviceCS->save(); |
| 332 } | 331 } |
| 333 } | 332 } |
| 334 | 333 |
| 335 ~SkDrawIter() { | 334 ~SkDrawIter() { |
| 336 if (fMultiDeviceCS) { | 335 if (fMultiDeviceCS) { |
| 337 fMultiDeviceCS->restore(); | 336 fMultiDeviceCS->restore(); |
| 338 } | 337 } |
| 339 } | 338 } |
| 340 | 339 |
| (...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 959 pixels = ((const char*)pixels - y * rowBytes - x * info.bytesPerPixel()); | 958 pixels = ((const char*)pixels - y * rowBytes - x * info.bytesPerPixel()); |
| 960 | 959 |
| 961 // Tell our owning surface to bump its generation ID | 960 // Tell our owning surface to bump its generation ID |
| 962 const bool completeOverwrite = info.dimensions() == size; | 961 const bool completeOverwrite = info.dimensions() == size; |
| 963 this->predrawNotify(completeOverwrite); | 962 this->predrawNotify(completeOverwrite); |
| 964 | 963 |
| 965 // The device can assert that the requested area is always contained in its
bounds | 964 // The device can assert that the requested area is always contained in its
bounds |
| 966 return device->writePixels(info, pixels, rowBytes, target.x(), target.y()); | 965 return device->writePixels(info, pixels, rowBytes, target.x(), target.y()); |
| 967 } | 966 } |
| 968 | 967 |
| 969 SkCanvas* SkCanvas::canvasForDrawIter() { | |
| 970 return this; | |
| 971 } | |
| 972 | |
| 973 ////////////////////////////////////////////////////////////////////////////// | 968 ////////////////////////////////////////////////////////////////////////////// |
| 974 | 969 |
| 975 void SkCanvas::updateDeviceCMCache() { | 970 void SkCanvas::updateDeviceCMCache() { |
| 976 if (fDeviceCMDirty) { | 971 if (fDeviceCMDirty) { |
| 977 const SkMatrix& totalMatrix = this->getTotalMatrix(); | 972 const SkMatrix& totalMatrix = this->getTotalMatrix(); |
| 978 const SkRasterClip& totalClip = fMCRec->fRasterClip; | 973 const SkRasterClip& totalClip = fMCRec->fRasterClip; |
| 979 DeviceCM* layer = fMCRec->fTopLayer; | 974 DeviceCM* layer = fMCRec->fTopLayer; |
| 980 | 975 |
| 981 if (nullptr == layer->fNext) { // only one layer | 976 if (nullptr == layer->fNext) { // only one layer |
| 982 layer->updateMC(totalMatrix, totalClip, nullptr); | 977 layer->updateMC(totalMatrix, totalClip, nullptr); |
| (...skipping 2410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3393 const SkCanvas::ClipOp SkCanvas::kXOR_Op; | 3388 const SkCanvas::ClipOp SkCanvas::kXOR_Op; |
| 3394 const SkCanvas::ClipOp SkCanvas::kReverseDifference_Op; | 3389 const SkCanvas::ClipOp SkCanvas::kReverseDifference_Op; |
| 3395 const SkCanvas::ClipOp SkCanvas::kReplace_Op; | 3390 const SkCanvas::ClipOp SkCanvas::kReplace_Op; |
| 3396 | 3391 |
| 3397 static_assert((int)SkRegion::kDifference_Op == (int)kDifference_SkClipOp
, ""); | 3392 static_assert((int)SkRegion::kDifference_Op == (int)kDifference_SkClipOp
, ""); |
| 3398 static_assert((int)SkRegion::kIntersect_Op == (int)kIntersect_SkClipOp,
""); | 3393 static_assert((int)SkRegion::kIntersect_Op == (int)kIntersect_SkClipOp,
""); |
| 3399 static_assert((int)SkRegion::kUnion_Op == (int)kUnion_SkClipOp, "")
; | 3394 static_assert((int)SkRegion::kUnion_Op == (int)kUnion_SkClipOp, "")
; |
| 3400 static_assert((int)SkRegion::kXOR_Op == (int)kXOR_SkClipOp, ""); | 3395 static_assert((int)SkRegion::kXOR_Op == (int)kXOR_SkClipOp, ""); |
| 3401 static_assert((int)SkRegion::kReverseDifference_Op == (int)kReverseDifference_S
kClipOp, ""); | 3396 static_assert((int)SkRegion::kReverseDifference_Op == (int)kReverseDifference_S
kClipOp, ""); |
| 3402 static_assert((int)SkRegion::kReplace_Op == (int)kReplace_SkClipOp, "
"); | 3397 static_assert((int)SkRegion::kReplace_Op == (int)kReplace_SkClipOp, "
"); |
| OLD | NEW |