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

Side by Side Diff: src/gpu/GrTexture.cpp

Issue 1380153002: Fix for texture width or height are greater than 2^16 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: feedback inc Created 5 years, 2 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 | « no previous file | no next file » | 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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 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 #include "GrContext.h" 9 #include "GrContext.h"
10 #include "GrCaps.h" 10 #include "GrCaps.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 this->setScratchKey(key); 91 this->setScratchKey(key);
92 } 92 }
93 // only make sense if alloc size is pow2 93 // only make sense if alloc size is pow2
94 fShiftFixedX = 31 - SkCLZ(fDesc.fWidth); 94 fShiftFixedX = 31 - SkCLZ(fDesc.fWidth);
95 fShiftFixedY = 31 - SkCLZ(fDesc.fHeight); 95 fShiftFixedY = 31 - SkCLZ(fDesc.fHeight);
96 } 96 }
97 97
98 void GrTexturePriv::ComputeScratchKey(const GrSurfaceDesc& desc, GrScratchKey* k ey) { 98 void GrTexturePriv::ComputeScratchKey(const GrSurfaceDesc& desc, GrScratchKey* k ey) {
99 static const GrScratchKey::ResourceType kType = GrScratchKey::GenerateResour ceType(); 99 static const GrScratchKey::ResourceType kType = GrScratchKey::GenerateResour ceType();
100 100
101 GrScratchKey::Builder builder(key, kType, 2);
102
103 GrSurfaceOrigin origin = resolve_origin(desc); 101 GrSurfaceOrigin origin = resolve_origin(desc);
104 uint32_t flags = desc.fFlags & ~kCheckAllocation_GrSurfaceFlag; 102 uint32_t flags = desc.fFlags & ~kCheckAllocation_GrSurfaceFlag;
105 103
106 SkASSERT(desc.fWidth <= SK_MaxU16);
107 SkASSERT(desc.fHeight <= SK_MaxU16);
108 SkASSERT(static_cast<int>(desc.fConfig) < (1 << 6)); 104 SkASSERT(static_cast<int>(desc.fConfig) < (1 << 6));
109 SkASSERT(desc.fSampleCnt < (1 << 8)); 105 SkASSERT(desc.fSampleCnt < (1 << 8));
110 SkASSERT(flags < (1 << 10)); 106 SkASSERT(flags < (1 << 10));
111 SkASSERT(static_cast<int>(origin) < (1 << 8)); 107 SkASSERT(static_cast<int>(origin) < (1 << 8));
112 108
113 builder[0] = desc.fWidth | (desc.fHeight << 16); 109 GrScratchKey::Builder builder(key, kType, 3);
114 builder[1] = desc.fConfig | (desc.fSampleCnt << 6) | (flags << 14) | (origin << 24); 110 builder[0] = desc.fWidth;
111 builder[1] = desc.fHeight;
112 builder[2] = desc.fConfig | (desc.fSampleCnt << 6) | (flags << 14) | (origin << 24);
115 } 113 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698