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

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

Issue 1809693002: Revert of Use std::unique_ptr. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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 | « src/core/SkSharedMutex.h ('k') | src/gpu/text/GrStencilAndCoverTextContext.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 2010 Google Inc. 3 * Copyright 2010 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 "GrGpuResourcePriv.h" 9 #include "GrGpuResourcePriv.h"
10 #include "GrLayerAtlas.h" 10 #include "GrLayerAtlas.h"
11 #include "GrRectanizer.h" 11 #include "GrRectanizer.h"
12 #include "GrTextureProvider.h" 12 #include "GrTextureProvider.h"
13 13
14 /////////////////////////////////////////////////////////////////////////////// 14 ///////////////////////////////////////////////////////////////////////////////
15 GrLayerAtlas::Plot::Plot() 15 GrLayerAtlas::Plot::Plot()
16 : fID(-1) 16 : fID(-1)
17 , fRects(nullptr) { 17 , fRects(nullptr) {
18 fOffset.set(0, 0); 18 fOffset.set(0, 0);
19 } 19 }
20 20
21 GrLayerAtlas::Plot::~Plot() { 21 GrLayerAtlas::Plot::~Plot() {
22 delete fRects; 22 delete fRects;
23 } 23 }
24 24
25 void GrLayerAtlas::Plot::init(int id, int offX, int offY, int width, int height) { 25 void GrLayerAtlas::Plot::init(int id, int offX, int offY, int width, int height) {
(...skipping 21 matching lines...) Expand all
47 GR_DECLARE_STATIC_UNIQUE_KEY(gLayerAtlasKey); 47 GR_DECLARE_STATIC_UNIQUE_KEY(gLayerAtlasKey);
48 static const GrUniqueKey& get_layer_atlas_key() { 48 static const GrUniqueKey& get_layer_atlas_key() {
49 GR_DEFINE_STATIC_UNIQUE_KEY(gLayerAtlasKey); 49 GR_DEFINE_STATIC_UNIQUE_KEY(gLayerAtlasKey);
50 return gLayerAtlasKey; 50 return gLayerAtlasKey;
51 } 51 }
52 52
53 bool GrLayerAtlas::reattachBackingTexture() { 53 bool GrLayerAtlas::reattachBackingTexture() {
54 SkASSERT(!fTexture); 54 SkASSERT(!fTexture);
55 55
56 fTexture.reset(fTexProvider->findAndRefTextureByUniqueKey(get_layer_atlas_ke y())); 56 fTexture.reset(fTexProvider->findAndRefTextureByUniqueKey(get_layer_atlas_ke y()));
57 return fTexture != nullptr; 57 return SkToBool(fTexture);
58 } 58 }
59 59
60 void GrLayerAtlas::createBackingTexture() { 60 void GrLayerAtlas::createBackingTexture() {
61 SkASSERT(!fTexture); 61 SkASSERT(!fTexture);
62 62
63 GrSurfaceDesc desc; 63 GrSurfaceDesc desc;
64 desc.fFlags = fFlags; 64 desc.fFlags = fFlags;
65 desc.fWidth = fBackingTextureSize.width(); 65 desc.fWidth = fBackingTextureSize.width();
66 desc.fHeight = fBackingTextureSize.height(); 66 desc.fHeight = fBackingTextureSize.height();
67 desc.fConfig = fPixelConfig; 67 desc.fConfig = fPixelConfig;
68 68
69 fTexture.reset(fTexProvider->createTexture(desc, SkBudgeted::kYes, nullptr, 0)); 69 fTexture.reset(fTexProvider->createTexture(desc, SkBudgeted::kYes, nullptr, 0));
70 70
71 fTexture->resourcePriv().setUniqueKey(get_layer_atlas_key()); 71 fTexture->resourcePriv().setUniqueKey(get_layer_atlas_key());
72 } 72 }
73 73
74 GrLayerAtlas::GrLayerAtlas(GrTextureProvider* texProvider, GrPixelConfig config, 74 GrLayerAtlas::GrLayerAtlas(GrTextureProvider* texProvider, GrPixelConfig config,
75 GrSurfaceFlags flags, 75 GrSurfaceFlags flags,
76 const SkISize& backingTextureSize, 76 const SkISize& backingTextureSize,
77 int numPlotsX, int numPlotsY) { 77 int numPlotsX, int numPlotsY) {
78 fTexProvider = texProvider; 78 fTexProvider = texProvider;
79 fPixelConfig = config; 79 fPixelConfig = config;
80 fFlags = flags; 80 fFlags = flags;
81 fBackingTextureSize = backingTextureSize; 81 fBackingTextureSize = backingTextureSize;
82 82
83 int textureWidth = fBackingTextureSize.width(); 83 int textureWidth = fBackingTextureSize.width();
84 int textureHeight = fBackingTextureSize.height(); 84 int textureHeight = fBackingTextureSize.height();
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 usage->appendPlot(plot); 161 usage->appendPlot(plot);
162 return plot; 162 return plot;
163 } 163 }
164 plotIter.next(); 164 plotIter.next();
165 } 165 }
166 166
167 // If the above fails, then the current plot list has no room 167 // If the above fails, then the current plot list has no room
168 return nullptr; 168 return nullptr;
169 } 169 }
170 170
OLDNEW
« no previous file with comments | « src/core/SkSharedMutex.h ('k') | src/gpu/text/GrStencilAndCoverTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698