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

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

Issue 1623653002: skia: Add support for CHROMIUM_image backed textures. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Add missing ')'. 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/GrTypes.h ('k') | src/gpu/GrTextureProvider.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 /* 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 return desc.fOrigin; 78 return desc.fOrigin;
79 } 79 }
80 } 80 }
81 } 81 }
82 82
83 ////////////////////////////////////////////////////////////////////////////// 83 //////////////////////////////////////////////////////////////////////////////
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 GrScratchKey key; 90 GrScratchKey key;
90 GrTexturePriv::ComputeScratchKey(desc, &key); 91 GrTexturePriv::ComputeScratchKey(desc, &key);
91 this->setScratchKey(key); 92 this->setScratchKey(key);
92 } 93 }
93 // only make sense if alloc size is pow2 94 // only make sense if alloc size is pow2
94 fShiftFixedX = 31 - SkCLZ(fDesc.fWidth); 95 fShiftFixedX = 31 - SkCLZ(fDesc.fWidth);
95 fShiftFixedY = 31 - SkCLZ(fDesc.fHeight); 96 fShiftFixedY = 31 - SkCLZ(fDesc.fHeight);
96 } 97 }
97 98
98 void GrTexturePriv::ComputeScratchKey(const GrSurfaceDesc& desc, GrScratchKey* k ey) { 99 void GrTexturePriv::ComputeScratchKey(const GrSurfaceDesc& desc, GrScratchKey* k ey) {
99 static const GrScratchKey::ResourceType kType = GrScratchKey::GenerateResour ceType(); 100 static const GrScratchKey::ResourceType kType = GrScratchKey::GenerateResour ceType();
100 101
101 GrSurfaceOrigin origin = resolve_origin(desc); 102 GrSurfaceOrigin origin = resolve_origin(desc);
102 uint32_t flags = desc.fFlags & ~kCheckAllocation_GrSurfaceFlag; 103 uint32_t flags = desc.fFlags & ~kCheckAllocation_GrSurfaceFlag;
103 104
104 SkASSERT(static_cast<int>(desc.fConfig) < (1 << 6)); 105 SkASSERT(static_cast<int>(desc.fConfig) < (1 << 6));
105 SkASSERT(desc.fSampleCnt < (1 << 8)); 106 SkASSERT(desc.fSampleCnt < (1 << 8));
106 SkASSERT(flags < (1 << 10)); 107 SkASSERT(flags < (1 << 10));
107 SkASSERT(static_cast<int>(origin) < (1 << 8)); 108 SkASSERT(static_cast<int>(origin) < (1 << 8));
108 109
109 GrScratchKey::Builder builder(key, kType, 3); 110 GrScratchKey::Builder builder(key, kType, 3);
110 builder[0] = desc.fWidth; 111 builder[0] = desc.fWidth;
111 builder[1] = desc.fHeight; 112 builder[1] = desc.fHeight;
112 builder[2] = desc.fConfig | (desc.fSampleCnt << 6) | (flags << 14) | (origin << 24); 113 builder[2] = desc.fConfig | (desc.fSampleCnt << 6) | (flags << 14) | (origin << 24);
113 } 114 }
OLDNEW
« no previous file with comments | « include/gpu/GrTypes.h ('k') | src/gpu/GrTextureProvider.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698