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

Unified Diff: src/gpu/GrAtlas.cpp

Issue 354533004: Begin atlasing (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Readd missing file Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrAtlas.h ('k') | src/gpu/GrLayerCache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrAtlas.cpp
diff --git a/src/gpu/GrAtlas.cpp b/src/gpu/GrAtlas.cpp
index 30b4bac13938b5f48bafbb0e1a45e810902bdcaa..1bff42a82ff8dc3f9c3e82e8887121e9c49f5565 100644
--- a/src/gpu/GrAtlas.cpp
+++ b/src/gpu/GrAtlas.cpp
@@ -54,8 +54,7 @@ static inline void adjust_for_offset(SkIPoint16* loc, const SkIPoint16& offset)
loc->fY += offset.fY;
}
-bool GrPlot::addSubImage(int width, int height, const void* image,
- SkIPoint16* loc) {
+bool GrPlot::addSubImage(int width, int height, const void* image, SkIPoint16* loc) {
float percentFull = fRects->percentFull();
if (!fRects->addRect(width, height, loc)) {
return false;
@@ -88,7 +87,7 @@ bool GrPlot::addSubImage(int width, int height, const void* image,
adjust_for_offset(loc, fOffset);
fDirty = true;
// otherwise, just upload the image directly
- } else {
+ } else if (NULL != image) {
adjust_for_offset(loc, fOffset);
GrContext* context = fTexture->getContext();
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("skia.gpu"), "GrPlot::uploadToTexture");
@@ -96,6 +95,8 @@ bool GrPlot::addSubImage(int width, int height, const void* image,
loc->fX, loc->fY, width, height,
fTexture->config(), image, 0,
GrContext::kDontFlush_PixelOpsFlag);
+ } else {
+ adjust_for_offset(loc, fOffset);
}
#if FONT_CACHE_STATS
@@ -146,11 +147,12 @@ void GrPlot::resetRects() {
///////////////////////////////////////////////////////////////////////////////
-GrAtlas::GrAtlas(GrGpu* gpu, GrPixelConfig config,
+GrAtlas::GrAtlas(GrGpu* gpu, GrPixelConfig config, GrTextureFlags flags,
const SkISize& backingTextureSize,
int numPlotsX, int numPlotsY, bool batchUploads) {
fGpu = SkRef(gpu);
fPixelConfig = config;
+ fFlags = flags;
fBackingTextureSize = backingTextureSize;
fNumPlotsX = numPlotsX;
fNumPlotsY = numPlotsY;
@@ -221,7 +223,7 @@ GrPlot* GrAtlas::addToAtlas(ClientPlotUsage* usage,
if (NULL == fTexture) {
// TODO: Update this to use the cache rather than directly creating a texture.
GrTextureDesc desc;
- desc.fFlags = kDynamicUpdate_GrTextureFlagBit;
+ desc.fFlags = fFlags | kDynamicUpdate_GrTextureFlagBit;
desc.fWidth = fBackingTextureSize.width();
desc.fHeight = fBackingTextureSize.height();
desc.fConfig = fPixelConfig;
« no previous file with comments | « src/gpu/GrAtlas.h ('k') | src/gpu/GrLayerCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698