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

Side by Side Diff: src/gpu/GrDrawTarget.h

Issue 1144013007: Remove GrContext from GrClipMaskCache (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « src/gpu/GrClipMaskManager.cpp ('k') | src/gpu/GrDrawTarget.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2010 Google Inc. 2 * Copyright 2010 Google Inc.
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 #ifndef GrDrawTarget_DEFINED 8 #ifndef GrDrawTarget_DEFINED
9 #define GrDrawTarget_DEFINED 9 #define GrDrawTarget_DEFINED
10 10
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 bool fFlushing; 322 bool fFlushing;
323 323
324 typedef SkRefCnt INHERITED; 324 typedef SkRefCnt INHERITED;
325 }; 325 };
326 326
327 /* 327 /*
328 * This class is JUST for clip mask manager. Everyone else should just use draw target above. 328 * This class is JUST for clip mask manager. Everyone else should just use draw target above.
329 */ 329 */
330 class GrClipTarget : public GrDrawTarget { 330 class GrClipTarget : public GrDrawTarget {
331 public: 331 public:
332 GrClipTarget(GrContext* context) 332 GrClipTarget(GrContext*);
333 : INHERITED(context) {
334 fClipMaskManager.setClipTarget(this);
335 }
336 333
337 /* Clip mask manager needs access to the context. 334 /* Clip mask manager needs access to the context.
338 * TODO we only need a very small subset of context in the CMM. 335 * TODO we only need a very small subset of context in the CMM.
339 */ 336 */
340 GrContext* getContext() { return INHERITED::getContext(); } 337 GrContext* getContext() { return INHERITED::getContext(); }
341 const GrContext* getContext() const { return INHERITED::getContext(); } 338 const GrContext* getContext() const { return INHERITED::getContext(); }
342 339
343 /** 340 /**
344 * Clip Mask Manager(and no one else) needs to clear private stencil bits. 341 * Clip Mask Manager(and no one else) needs to clear private stencil bits.
345 * ClipTarget subclass sets clip bit in the stencil buffer. The subclass 342 * ClipTarget subclass sets clip bit in the stencil buffer. The subclass
346 * is free to clear the remaining bits to zero if masked clears are more 343 * is free to clear the remaining bits to zero if masked clears are more
347 * expensive than clearing all bits. 344 * expensive than clearing all bits.
348 */ 345 */
349 virtual void clearStencilClip(const SkIRect& rect, bool insideClip, GrRender Target* = NULL) = 0; 346 virtual void clearStencilClip(const SkIRect& rect, bool insideClip, GrRender Target* = NULL) = 0;
350 347
351 /** 348 /**
352 * Release any resources that are cached but not currently in use. This 349 * Release any resources that are cached but not currently in use. This
353 * is intended to give an application some recourse when resources are low. 350 * is intended to give an application some recourse when resources are low.
354 */ 351 */
355 void purgeResources() override { 352 void purgeResources() override;
356 // The clip mask manager can rebuild all its clip masks so just
357 // get rid of them all.
358 fClipMaskManager.purgeResources();
359 };
360 353
361 protected: 354 protected:
362 GrClipMaskManager fClipMaskManager; 355 SkAutoTDelete<GrClipMaskManager> fClipMaskManager;
363 356
364 private: 357 private:
365 GrClipMaskManager* clipMaskManager() override { return &fClipMaskManager; } 358 GrClipMaskManager* clipMaskManager() override { return fClipMaskManager; }
366 359
367 virtual bool setupClip(GrPipelineBuilder*, 360 virtual bool setupClip(GrPipelineBuilder*,
368 GrPipelineBuilder::AutoRestoreFragmentProcessors*, 361 GrPipelineBuilder::AutoRestoreFragmentProcessors*,
369 GrPipelineBuilder::AutoRestoreStencil*, 362 GrPipelineBuilder::AutoRestoreStencil*,
370 GrScissorState* scissorState, 363 GrScissorState* scissorState,
371 const SkRect* devBounds) override; 364 const SkRect* devBounds) override;
372 365
373 typedef GrDrawTarget INHERITED; 366 typedef GrDrawTarget INHERITED;
374 }; 367 };
375 368
376 #endif 369 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrClipMaskManager.cpp ('k') | src/gpu/GrDrawTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698