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

Side by Side Diff: include/gpu/GrTypesPriv.h

Issue 2246113002: Convert GrAppliedClip interface to builder style (Closed) Base URL: https://skia.googlesource.com/skia.git@fixstencilpath
Patch Set: Convert GrAppliedClip interface to builder style Created 4 years, 4 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 | « include/gpu/GrClip.h ('k') | src/gpu/GrClip.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 2013 Google Inc. 2 * Copyright 2013 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 GrTypesPriv_DEFINED 8 #ifndef GrTypesPriv_DEFINED
9 #define GrTypesPriv_DEFINED 9 #define GrTypesPriv_DEFINED
10 10
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 kRead_GrIOType, 418 kRead_GrIOType,
419 kWrite_GrIOType, 419 kWrite_GrIOType,
420 kRW_GrIOType 420 kRW_GrIOType
421 }; 421 };
422 422
423 struct GrScissorState { 423 struct GrScissorState {
424 GrScissorState() : fEnabled(false) {} 424 GrScissorState() : fEnabled(false) {}
425 GrScissorState(const SkIRect& rect) : fEnabled(true), fRect(rect) {} 425 GrScissorState(const SkIRect& rect) : fEnabled(true), fRect(rect) {}
426 void setDisabled() { fEnabled = false; } 426 void setDisabled() { fEnabled = false; }
427 void set(const SkIRect& rect) { fRect = rect; fEnabled = true; } 427 void set(const SkIRect& rect) { fRect = rect; fEnabled = true; }
428 bool SK_WARN_UNUSED_RESULT intersect(const SkIRect& rect) {
429 if (!fEnabled) {
430 this->set(rect);
431 return true;
432 }
433 return fRect.intersect(rect);
434 }
428 bool operator==(const GrScissorState& other) const { 435 bool operator==(const GrScissorState& other) const {
429 return fEnabled == other.fEnabled && 436 return fEnabled == other.fEnabled &&
430 (false == fEnabled || fRect == other.fRect); 437 (false == fEnabled || fRect == other.fRect);
431 } 438 }
432 bool operator!=(const GrScissorState& other) const { return !(*this == other ); } 439 bool operator!=(const GrScissorState& other) const { return !(*this == other ); }
433 440
434 bool enabled() const { return fEnabled; } 441 bool enabled() const { return fEnabled; }
435 const SkIRect& rect() const { return fRect; } 442 const SkIRect& rect() const { return fRect; }
436 443
437 private: 444 private:
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 /** Holder destroys the backend object. */ 503 /** Holder destroys the backend object. */
497 kOwned = true 504 kOwned = true
498 }; 505 };
499 506
500 template <typename T> T * const * sk_sp_address_as_pointer_address(sk_sp<T> cons t * sp) { 507 template <typename T> T * const * sk_sp_address_as_pointer_address(sk_sp<T> cons t * sp) {
501 static_assert(sizeof(T*) == sizeof(sk_sp<T>), "sk_sp not expected size."); 508 static_assert(sizeof(T*) == sizeof(sk_sp<T>), "sk_sp not expected size.");
502 return reinterpret_cast<T * const *>(sp); 509 return reinterpret_cast<T * const *>(sp);
503 } 510 }
504 511
505 #endif 512 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrClip.h ('k') | src/gpu/GrClip.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698