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

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

Issue 1249543003: Creating functions for uploading a mipmapped texture. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Fixing merge mistakes 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
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 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 #include "GrSurface.h" 8 #include "GrSurface.h"
9 #include "GrSurfacePriv.h" 9 #include "GrSurfacePriv.h"
10 10
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 const void** data, 85 const void** data,
86 size_t* rowBytes) { 86 size_t* rowBytes) {
87 return adjust_params<const void>(surfaceWidth, surfaceHeight, bpp, left, top , width, height, 87 return adjust_params<const void>(surfaceWidth, surfaceHeight, bpp, left, top , width, height,
88 data, rowBytes); 88 data, rowBytes);
89 } 89 }
90 90
91 91
92 ////////////////////////////////////////////////////////////////////////////// 92 //////////////////////////////////////////////////////////////////////////////
93 93
94 bool GrSurface::writePixels(int left, int top, int width, int height, 94 bool GrSurface::writePixels(int left, int top, int width, int height,
95 GrPixelConfig config, const void* buffer, size_t row Bytes, 95 GrPixelConfig config, const SkTArray<SkMipMapLevel>& texels,
96 uint32_t pixelOpsFlags) { 96 uint32_t pixelOpsFlags) {
97 // go through context so that all necessary flushing occurs 97 // go through context so that all necessary flushing occurs
98 GrContext* context = this->getContext(); 98 GrContext* context = this->getContext();
99 if (nullptr == context) { 99 if (nullptr == context) {
100 return false; 100 return false;
101 } 101 }
102 return context->writeSurfacePixels(this, left, top, width, height, config, b uffer, rowBytes, 102 return context->writeSurfacePixels(this, left, top, width, height, config, t exels,
103 pixelOpsFlags); 103 pixelOpsFlags);
104 } 104 }
105 105
106 bool GrSurface::writePixels(int left, int top, int width, int height,
107 GrPixelConfig config, const void* buffer, size_t row Bytes,
108 uint32_t pixelOpsFlags) {
109 // make sure the size's range fits within the texelmap's size range
110 if (width <= 0 || height <= 0) {
111 return false;
112 }
113 const uint32_t baseLevelWidth = width;
114 const uint32_t baseLevelHeight = height;
115
116 SkMipMapLevel level(buffer, rowBytes, baseLevelWidth, baseLevelHeight);
117 const int levelCount = 1;
118 SkTArray<SkMipMapLevel> texels(levelCount);
119 texels.push_back(level);
120
121 return this->writePixels(left, top, width, height, config, texels, pixelOpsF lags);
122 }
123
106 bool GrSurface::readPixels(int left, int top, int width, int height, 124 bool GrSurface::readPixels(int left, int top, int width, int height,
107 GrPixelConfig config, void* buffer, size_t rowBytes, 125 GrPixelConfig config, void* buffer, size_t rowBytes,
108 uint32_t pixelOpsFlags) { 126 uint32_t pixelOpsFlags) {
109 // go through context so that all necessary flushing occurs 127 // go through context so that all necessary flushing occurs
110 GrContext* context = this->getContext(); 128 GrContext* context = this->getContext();
111 if (nullptr == context) { 129 if (nullptr == context) {
112 return false; 130 return false;
113 } 131 }
114 return context->readSurfacePixels(this, left, top, width, height, config, bu ffer, 132 return context->readSurfacePixels(this, left, top, width, height, config, bu ffer,
115 rowBytes, pixelOpsFlags); 133 rowBytes, pixelOpsFlags);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 220
203 void GrSurface::onRelease() { 221 void GrSurface::onRelease() {
204 this->invokeReleaseProc(); 222 this->invokeReleaseProc();
205 this->INHERITED::onRelease(); 223 this->INHERITED::onRelease();
206 } 224 }
207 225
208 void GrSurface::onAbandon() { 226 void GrSurface::onAbandon() {
209 this->invokeReleaseProc(); 227 this->invokeReleaseProc();
210 this->INHERITED::onAbandon(); 228 this->INHERITED::onAbandon();
211 } 229 }
OLDNEW
« include/gpu/GrContext.h ('K') | « src/gpu/GrGpu.cpp ('k') | src/gpu/GrTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698