Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Unified Diff: src/core/SkBBoxHierarchyRecord.cpp

Issue 617953002: Strip old backend recording down to essentials (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: debug-only Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkBBoxHierarchyRecord.h ('k') | src/core/SkBBoxRecord.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBBoxHierarchyRecord.cpp
diff --git a/src/core/SkBBoxHierarchyRecord.cpp b/src/core/SkBBoxHierarchyRecord.cpp
deleted file mode 100644
index a9cd05d85ff1dc3cf1028ac29982025e44b50d53..0000000000000000000000000000000000000000
--- a/src/core/SkBBoxHierarchyRecord.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-
-/*
- * Copyright 2012 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkBBoxHierarchyRecord.h"
-#include "SkPictureStateTree.h"
-
-SkBBoxHierarchyRecord::SkBBoxHierarchyRecord(const SkISize& size,
- uint32_t recordFlags,
- SkBBoxHierarchy* h)
- : INHERITED(size, recordFlags) {
- fStateTree = SkNEW(SkPictureStateTree);
- fBoundingHierarchy = h;
- fBoundingHierarchy->ref();
- fBoundingHierarchy->setClient(this);
-}
-
-void SkBBoxHierarchyRecord::handleBBox(const SkRect& bounds) {
- SkPictureStateTree::Draw* draw = fStateTree->appendDraw(this->writeStream().bytesWritten());
- fBoundingHierarchy->insert(draw, bounds, true);
-}
-
-void SkBBoxHierarchyRecord::willSave() {
- fStateTree->appendSave();
- this->INHERITED::willSave();
-}
-
-SkCanvas::SaveLayerStrategy SkBBoxHierarchyRecord::willSaveLayer(const SkRect* bounds,
- const SkPaint* paint,
- SaveFlags flags) {
- // For now, assume all filters affect transparent black.
- // FIXME: This could be made less conservative as an optimization.
- bool paintAffectsTransparentBlack = paint &&
- ((paint->getImageFilter()) ||
- (paint->getColorFilter()));
- bool needToHandleBBox = paintAffectsTransparentBlack;
- if (!needToHandleBBox && paint) {
- // Unusual Xfermodes require us to process a saved layer
- // even with operations outisde the clip.
- // For example, DstIn is used by masking layers.
- // https://code.google.com/p/skia/issues/detail?id=1291
- SkXfermode* xfermode = paint->getXfermode();
- SkXfermode::Mode mode;
- // SrcOver is the common case with a NULL xfermode, so we should
- // make that the fast path and bypass the mode extraction and test.
- if (xfermode && xfermode->asMode(&mode)) {
- switch (mode) {
- case SkXfermode::kClear_Mode:
- case SkXfermode::kSrc_Mode:
- case SkXfermode::kSrcIn_Mode:
- case SkXfermode::kDstIn_Mode:
- case SkXfermode::kSrcOut_Mode:
- case SkXfermode::kDstATop_Mode:
- case SkXfermode::kModulate_Mode:
- needToHandleBBox = true;
- break;
- default:
- break;
- }
- }
- }
-
- SkRect drawBounds;
- if (needToHandleBBox) {
- SkIRect deviceBounds;
- this->getClipDeviceBounds(&deviceBounds);
- drawBounds.set(deviceBounds);
- }
- fStateTree->appendSaveLayer(this->writeStream().bytesWritten());
- SkCanvas::SaveLayerStrategy strategy = this->INHERITED::willSaveLayer(bounds, paint, flags);
- if (needToHandleBBox) {
- this->handleBBox(drawBounds);
- this->addNoOp();
- }
- return strategy;
-}
-
-void SkBBoxHierarchyRecord::willRestore() {
- fStateTree->appendRestore();
- this->INHERITED::willRestore();
-}
-
-void SkBBoxHierarchyRecord::didConcat(const SkMatrix& matrix) {
- fStateTree->appendTransform(getTotalMatrix());
- INHERITED::didConcat(matrix);
-}
-
-void SkBBoxHierarchyRecord::didSetMatrix(const SkMatrix& matrix) {
- fStateTree->appendTransform(getTotalMatrix());
- INHERITED::didSetMatrix(matrix);
-}
-
-void SkBBoxHierarchyRecord::onClipRect(const SkRect& rect,
- SkRegion::Op op,
- ClipEdgeStyle edgeStyle) {
- fStateTree->appendClip(this->writeStream().bytesWritten());
- this->INHERITED::onClipRect(rect, op, edgeStyle);
-}
-
-void SkBBoxHierarchyRecord::onClipRegion(const SkRegion& region,
- SkRegion::Op op) {
- fStateTree->appendClip(this->writeStream().bytesWritten());
- this->INHERITED::onClipRegion(region, op);
-}
-
-void SkBBoxHierarchyRecord::onClipPath(const SkPath& path,
- SkRegion::Op op,
- ClipEdgeStyle edgeStyle) {
- fStateTree->appendClip(this->writeStream().bytesWritten());
- this->INHERITED::onClipPath(path, op, edgeStyle);
-}
-
-void SkBBoxHierarchyRecord::onClipRRect(const SkRRect& rrect,
- SkRegion::Op op,
- ClipEdgeStyle edgeStyle) {
- fStateTree->appendClip(this->writeStream().bytesWritten());
- this->INHERITED::onClipRRect(rrect, op, edgeStyle);
-}
-
-bool SkBBoxHierarchyRecord::shouldRewind(void* data) {
- // SkBBoxHierarchy::rewindInserts is called by SkPicture after the
- // SkPicture has rewound its command stream. To match that rewind in the
- // BBH, we rewind all draws that reference commands that were recorded
- // past the point to which the SkPicture has rewound, which is given by
- // writeStream().bytesWritten().
- SkPictureStateTree::Draw* draw = static_cast<SkPictureStateTree::Draw*>(data);
- return draw->fOffset >= writeStream().bytesWritten();
-}
« no previous file with comments | « src/core/SkBBoxHierarchyRecord.h ('k') | src/core/SkBBoxRecord.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698