16e832b50c712743d821e01829b127b86271a7ebbrileya@google.com
26e832b50c712743d821e01829b127b86271a7ebbrileya@google.com/*
36e832b50c712743d821e01829b127b86271a7ebbrileya@google.com * Copyright 2012 Google Inc.
46e832b50c712743d821e01829b127b86271a7ebbrileya@google.com *
56e832b50c712743d821e01829b127b86271a7ebbrileya@google.com * Use of this source code is governed by a BSD-style license that can be
66e832b50c712743d821e01829b127b86271a7ebbrileya@google.com * found in the LICENSE file.
76e832b50c712743d821e01829b127b86271a7ebbrileya@google.com */
86e832b50c712743d821e01829b127b86271a7ebbrileya@google.com
96e832b50c712743d821e01829b127b86271a7ebbrileya@google.com#ifndef SkRTreeCanvas_DEFINED
106e832b50c712743d821e01829b127b86271a7ebbrileya@google.com#define SkRTreeCanvas_DEFINED
116e832b50c712743d821e01829b127b86271a7ebbrileya@google.com
1247c2076e9e3b4777af036acfa5ff258a38cca586commit-bot@chromium.org#include "SkBBoxHierarchy.h"
136e832b50c712743d821e01829b127b86271a7ebbrileya@google.com#include "SkBBoxRecord.h"
146e832b50c712743d821e01829b127b86271a7ebbrileya@google.com
156e832b50c712743d821e01829b127b86271a7ebbrileya@google.com/**
166e832b50c712743d821e01829b127b86271a7ebbrileya@google.com * This records bounding box information into an SkBBoxHierarchy, and clip/transform information
176e832b50c712743d821e01829b127b86271a7ebbrileya@google.com * into an SkPictureStateTree to allow for efficient culling and correct playback of draws.
186e832b50c712743d821e01829b127b86271a7ebbrileya@google.com */
1947c2076e9e3b4777af036acfa5ff258a38cca586commit-bot@chromium.orgclass SkBBoxHierarchyRecord : public SkBBoxRecord, public SkBBoxHierarchyClient {
206e832b50c712743d821e01829b127b86271a7ebbrileya@google.compublic:
216e832b50c712743d821e01829b127b86271a7ebbrileya@google.com    /** This will take a ref of h */
22118a6d00c3089c0fcfce67919bbbeb37adda6423reed@google.com    SkBBoxHierarchyRecord(uint32_t recordFlags, SkBBoxHierarchy* h,
23118a6d00c3089c0fcfce67919bbbeb37adda6423reed@google.com                          SkDevice*);
246e832b50c712743d821e01829b127b86271a7ebbrileya@google.com
256e832b50c712743d821e01829b127b86271a7ebbrileya@google.com    virtual void handleBBox(const SkRect& bounds) SK_OVERRIDE;
266e832b50c712743d821e01829b127b86271a7ebbrileya@google.com
27961a69dffc5bc09a632257942c12d89160fb3947skia.committer@gmail.com    virtual int save(SaveFlags flags = kMatrixClip_SaveFlag) SK_OVERRIDE;
286e832b50c712743d821e01829b127b86271a7ebbrileya@google.com    virtual int saveLayer(const SkRect* bounds, const SkPaint* paint,
29961a69dffc5bc09a632257942c12d89160fb3947skia.committer@gmail.com                          SaveFlags flags = kARGB_ClipLayer_SaveFlag) SK_OVERRIDE;
30961a69dffc5bc09a632257942c12d89160fb3947skia.committer@gmail.com    virtual void restore() SK_OVERRIDE;
316e832b50c712743d821e01829b127b86271a7ebbrileya@google.com
32961a69dffc5bc09a632257942c12d89160fb3947skia.committer@gmail.com    virtual bool translate(SkScalar dx, SkScalar dy) SK_OVERRIDE;
33961a69dffc5bc09a632257942c12d89160fb3947skia.committer@gmail.com    virtual bool scale(SkScalar sx, SkScalar sy) SK_OVERRIDE;
346e832b50c712743d821e01829b127b86271a7ebbrileya@google.com    virtual bool rotate(SkScalar degrees) SK_OVERRIDE;
356e832b50c712743d821e01829b127b86271a7ebbrileya@google.com    virtual bool skew(SkScalar sx, SkScalar sy) SK_OVERRIDE;
366e832b50c712743d821e01829b127b86271a7ebbrileya@google.com    virtual bool concat(const SkMatrix& matrix) SK_OVERRIDE;
376e832b50c712743d821e01829b127b86271a7ebbrileya@google.com    virtual void setMatrix(const SkMatrix& matrix) SK_OVERRIDE;
386e832b50c712743d821e01829b127b86271a7ebbrileya@google.com
396e832b50c712743d821e01829b127b86271a7ebbrileya@google.com    virtual bool clipRect(const SkRect& rect,
406e832b50c712743d821e01829b127b86271a7ebbrileya@google.com                          SkRegion::Op op = SkRegion::kIntersect_Op,
41961a69dffc5bc09a632257942c12d89160fb3947skia.committer@gmail.com                          bool doAntiAlias = false) SK_OVERRIDE;
426e832b50c712743d821e01829b127b86271a7ebbrileya@google.com    virtual bool clipRegion(const SkRegion& region,
43961a69dffc5bc09a632257942c12d89160fb3947skia.committer@gmail.com                            SkRegion::Op op = SkRegion::kIntersect_Op) SK_OVERRIDE;
446e832b50c712743d821e01829b127b86271a7ebbrileya@google.com    virtual bool clipPath(const SkPath& path,
456e832b50c712743d821e01829b127b86271a7ebbrileya@google.com                          SkRegion::Op op = SkRegion::kIntersect_Op,
46961a69dffc5bc09a632257942c12d89160fb3947skia.committer@gmail.com                          bool doAntiAlias = false) SK_OVERRIDE;
47e157ba0a1552ee1ce92bb4bb6360a123332ea012junov@chromium.org    virtual bool clipRRect(const SkRRect& rrect,
48e157ba0a1552ee1ce92bb4bb6360a123332ea012junov@chromium.org                           SkRegion::Op op = SkRegion::kIntersect_Op,
49e157ba0a1552ee1ce92bb4bb6360a123332ea012junov@chromium.org                           bool doAntiAlias = false) SK_OVERRIDE;
506e832b50c712743d821e01829b127b86271a7ebbrileya@google.com
5147c2076e9e3b4777af036acfa5ff258a38cca586commit-bot@chromium.org    // Implementation of the SkBBoxHierarchyClient interface
5247c2076e9e3b4777af036acfa5ff258a38cca586commit-bot@chromium.org    virtual bool shouldRewind(void* data) SK_OVERRIDE;
5347c2076e9e3b4777af036acfa5ff258a38cca586commit-bot@chromium.org
546e832b50c712743d821e01829b127b86271a7ebbrileya@google.comprivate:
556e832b50c712743d821e01829b127b86271a7ebbrileya@google.com    typedef SkBBoxRecord INHERITED;
566e832b50c712743d821e01829b127b86271a7ebbrileya@google.com};
576e832b50c712743d821e01829b127b86271a7ebbrileya@google.com
586e832b50c712743d821e01829b127b86271a7ebbrileya@google.com#endif
59