OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 | 10 |
11 #include "GrDrawTarget.h" | 11 #include "GrDrawTarget.h" |
12 #include "GrContext.h" | 12 #include "GrContext.h" |
13 #include "GrDrawTargetCaps.h" | 13 #include "GrDrawTargetCaps.h" |
14 #include "GrPath.h" | 14 #include "GrPath.h" |
15 #include "GrRenderTarget.h" | 15 #include "GrRenderTarget.h" |
16 #include "GrSurfacePriv.h" | |
17 #include "GrTemplates.h" | 16 #include "GrTemplates.h" |
18 #include "GrTexture.h" | 17 #include "GrTexture.h" |
19 #include "GrVertexBuffer.h" | 18 #include "GrVertexBuffer.h" |
20 | 19 |
21 #include "SkStrokeRec.h" | 20 #include "SkStrokeRec.h" |
22 | 21 |
23 //////////////////////////////////////////////////////////////////////////////// | 22 //////////////////////////////////////////////////////////////////////////////// |
24 | 23 |
25 GrDrawTarget::DrawInfo& GrDrawTarget::DrawInfo::operator =(const DrawInfo& di) { | 24 GrDrawTarget::DrawInfo& GrDrawTarget::DrawInfo::operator =(const DrawInfo& di) { |
26 fPrimitiveType = di.fPrimitiveType; | 25 fPrimitiveType = di.fPrimitiveType; |
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
958 GrSurface* src, | 957 GrSurface* src, |
959 const SkIRect& srcRect, | 958 const SkIRect& srcRect, |
960 const SkIPoint& dstPoint) { | 959 const SkIPoint& dstPoint) { |
961 // Check that the read/write rects are contained within the src/dst bounds. | 960 // Check that the read/write rects are contained within the src/dst bounds. |
962 SkASSERT(!srcRect.isEmpty()); | 961 SkASSERT(!srcRect.isEmpty()); |
963 SkASSERT(SkIRect::MakeWH(src->width(), src->height()).contains(srcRect)); | 962 SkASSERT(SkIRect::MakeWH(src->width(), src->height()).contains(srcRect)); |
964 SkASSERT(dstPoint.fX >= 0 && dstPoint.fY >= 0); | 963 SkASSERT(dstPoint.fX >= 0 && dstPoint.fY >= 0); |
965 SkASSERT(dstPoint.fX + srcRect.width() <= dst->width() && | 964 SkASSERT(dstPoint.fX + srcRect.width() <= dst->width() && |
966 dstPoint.fY + srcRect.height() <= dst->height()); | 965 dstPoint.fY + srcRect.height() <= dst->height()); |
967 | 966 |
968 return !dst->surfacePriv().isSameAs(src) && dst->asRenderTarget() && src->as
Texture(); | 967 return !dst->isSameAs(src) && dst->asRenderTarget() && src->asTexture(); |
969 } | 968 } |
970 | 969 |
971 bool GrDrawTarget::onCopySurface(GrSurface* dst, | 970 bool GrDrawTarget::onCopySurface(GrSurface* dst, |
972 GrSurface* src, | 971 GrSurface* src, |
973 const SkIRect& srcRect, | 972 const SkIRect& srcRect, |
974 const SkIPoint& dstPoint) { | 973 const SkIPoint& dstPoint) { |
975 if (!GrDrawTarget::onCanCopySurface(dst, src, srcRect, dstPoint)) { | 974 if (!GrDrawTarget::onCanCopySurface(dst, src, srcRect, dstPoint)) { |
976 return false; | 975 return false; |
977 } | 976 } |
978 | 977 |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1151 | 1150 |
1152 uint32_t GrDrawTargetCaps::CreateUniqueID() { | 1151 uint32_t GrDrawTargetCaps::CreateUniqueID() { |
1153 static int32_t gUniqueID = SK_InvalidUniqueID; | 1152 static int32_t gUniqueID = SK_InvalidUniqueID; |
1154 uint32_t id; | 1153 uint32_t id; |
1155 do { | 1154 do { |
1156 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1); | 1155 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1); |
1157 } while (id == SK_InvalidUniqueID); | 1156 } while (id == SK_InvalidUniqueID); |
1158 return id; | 1157 return id; |
1159 } | 1158 } |
1160 | 1159 |
OLD | NEW |