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

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

Issue 1715063002: Simplify calculations in AADistanceFieldPathBatch::writePathVertices. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 4 years, 10 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/GrTexture.h ('k') | src/gpu/GrTexturePriv.h » ('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 /* 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 GrTexture::GrTexture(GrGpu* gpu, LifeCycle lifeCycle, const GrSurfaceDesc& desc) 84 GrTexture::GrTexture(GrGpu* gpu, LifeCycle lifeCycle, const GrSurfaceDesc& desc)
85 : INHERITED(gpu, lifeCycle, desc) 85 : INHERITED(gpu, lifeCycle, desc)
86 , fMipMapsStatus(kNotAllocated_MipMapsStatus) { 86 , fMipMapsStatus(kNotAllocated_MipMapsStatus) {
87 87
88 if (!this->isExternal() && !GrPixelConfigIsCompressed(desc.fConfig) && 88 if (!this->isExternal() && !GrPixelConfigIsCompressed(desc.fConfig) &&
89 !desc.fTextureStorageAllocator.fAllocateTextureStorage) { 89 !desc.fTextureStorageAllocator.fAllocateTextureStorage) {
90 GrScratchKey key; 90 GrScratchKey key;
91 GrTexturePriv::ComputeScratchKey(desc, &key); 91 GrTexturePriv::ComputeScratchKey(desc, &key);
92 this->setScratchKey(key); 92 this->setScratchKey(key);
93 } 93 }
94 // only make sense if alloc size is pow2
95 fShiftFixedX = 31 - SkCLZ(fDesc.fWidth);
96 fShiftFixedY = 31 - SkCLZ(fDesc.fHeight);
97 } 94 }
98 95
99 void GrTexturePriv::ComputeScratchKey(const GrSurfaceDesc& desc, GrScratchKey* k ey) { 96 void GrTexturePriv::ComputeScratchKey(const GrSurfaceDesc& desc, GrScratchKey* k ey) {
100 static const GrScratchKey::ResourceType kType = GrScratchKey::GenerateResour ceType(); 97 static const GrScratchKey::ResourceType kType = GrScratchKey::GenerateResour ceType();
101 98
102 GrSurfaceOrigin origin = resolve_origin(desc); 99 GrSurfaceOrigin origin = resolve_origin(desc);
103 uint32_t flags = desc.fFlags & ~kCheckAllocation_GrSurfaceFlag; 100 uint32_t flags = desc.fFlags & ~kCheckAllocation_GrSurfaceFlag;
104 101
105 SkASSERT(static_cast<int>(desc.fConfig) < (1 << 6)); 102 SkASSERT(static_cast<int>(desc.fConfig) < (1 << 6));
106 SkASSERT(desc.fSampleCnt < (1 << 8)); 103 SkASSERT(desc.fSampleCnt < (1 << 8));
107 SkASSERT(flags < (1 << 10)); 104 SkASSERT(flags < (1 << 10));
108 SkASSERT(static_cast<int>(origin) < (1 << 8)); 105 SkASSERT(static_cast<int>(origin) < (1 << 8));
109 106
110 GrScratchKey::Builder builder(key, kType, 3); 107 GrScratchKey::Builder builder(key, kType, 3);
111 builder[0] = desc.fWidth; 108 builder[0] = desc.fWidth;
112 builder[1] = desc.fHeight; 109 builder[1] = desc.fHeight;
113 builder[2] = desc.fConfig | (desc.fSampleCnt << 6) | (flags << 14) | (origin << 24); 110 builder[2] = desc.fConfig | (desc.fSampleCnt << 6) | (flags << 14) | (origin << 24);
114 } 111 }
OLDNEW
« no previous file with comments | « include/gpu/GrTexture.h ('k') | src/gpu/GrTexturePriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698