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

Unified Diff: src/gpu/GrBatch.h

Issue 1121463002: Move bounds to GrBatch (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks Created 5 years, 8 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
Index: src/gpu/GrBatch.h
diff --git a/src/gpu/GrBatch.h b/src/gpu/GrBatch.h
index 7d621e046a858573576b3aeab5013cc28a626e76..f9afff5e4050e7865410598ca6cc04fc333d657c 100644
--- a/src/gpu/GrBatch.h
+++ b/src/gpu/GrBatch.h
@@ -61,13 +61,15 @@ public:
return false;
}
- return onCombineIfPossible(that);
+ return this->onCombineIfPossible(that);
}
virtual bool onCombineIfPossible(GrBatch*) = 0;
virtual void generateGeometry(GrBatchTarget*, const GrPipeline*) = 0;
+ const SkRect& bounds() const { return fBounds; }
+
// TODO this goes away when batches are everywhere
void setNumberOfDraws(int numberOfDraws) { fNumberOfDraws = numberOfDraws; }
int numberOfDraws() const { return fNumberOfDraws; }
@@ -103,6 +105,15 @@ protected:
uint32_t fClassID;
+ // Its always better to compute some conservative bounds, but some calls are exceedingly
+ // infrequent or the cost to compute bounds would be extremely expensive
+ void setBoundsLargest() { fBounds.setLargest(); }
+ void setBounds(const SkRect& newBounds) { fBounds = newBounds; }
robertphillips 2015/05/01 13:03:00 Why not "const SkRect&" ?
joshualitt 2015/05/01 13:22:28 not sure I follow, the function signature is "cons
bsalomon 2015/05/01 13:24:53 Rob writes his comments using 0-based indexing. So
joshualitt 2015/05/01 13:49:58 lol, okay so, clients need to outset / map this re
bsalomon 2015/05/01 14:29:55 Does making fBounds protected solve your problem?
+ SkRect* getBounds() { return &fBounds; }
+
+ // TODO will our bounds ever actually be empty?
bsalomon 2015/04/30 18:53:23 probably should never be empty. Why have a batch t
joshualitt 2015/05/01 13:49:57 Well, it looks like the bounds for horizontal / ve
bsalomon 2015/05/01 14:29:55 Oh, duh. I guess we have a different meaning of "e
+ void joinBounds(const SkRect& otherBounds) { return fBounds.join(otherBounds); }
+
private:
static uint32_t GenClassID() {
// fCurrProcessorClassID has been initialized to kIllegalProcessorClassID. The
@@ -124,6 +135,7 @@ private:
SkDEBUGCODE(bool fUsed;)
int fNumberOfDraws;
+ SkRect fBounds;
typedef SkRefCnt INHERITED;
};

Powered by Google App Engine
This is Rietveld 408576698