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

Side by Side Diff: tools/picture_utils.cpp

Issue 139743010: Remove more unnamed namespace usages. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: align Created 6 years, 11 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 | Annotate | Revision Log
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 "picture_utils.h" 8 #include "picture_utils.h"
9 #include "SkColorPriv.h" 9 #include "SkColorPriv.h"
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
11 #include "SkPicture.h" 11 #include "SkPicture.h"
12 #include "SkString.h" 12 #include "SkString.h"
13 #include "SkStream.h" 13 #include "SkStream.h"
14 14
15 static bool is_path_seperator(const char chr) {
16 #if defined(SK_BUILD_FOR_WIN)
17 return chr == '\\' || chr == '/';
18 #else
19 return chr == '/';
20 #endif
21 }
22
15 namespace sk_tools { 23 namespace sk_tools {
16 void force_all_opaque(const SkBitmap& bitmap) { 24 void force_all_opaque(const SkBitmap& bitmap) {
17 SkASSERT(NULL == bitmap.getTexture()); 25 SkASSERT(NULL == bitmap.getTexture());
18 SkASSERT(SkBitmap::kARGB_8888_Config == bitmap.config()); 26 SkASSERT(SkBitmap::kARGB_8888_Config == bitmap.config());
19 if (NULL != bitmap.getTexture() || SkBitmap::kARGB_8888_Config == bitmap .config()) { 27 if (NULL != bitmap.getTexture() || SkBitmap::kARGB_8888_Config == bitmap .config()) {
20 return; 28 return;
21 } 29 }
22 30
23 SkAutoLockPixels lock(bitmap); 31 SkAutoLockPixels lock(bitmap);
24 for (int y = 0; y < bitmap.height(); y++) { 32 for (int y = 0; y < bitmap.height(); y++) {
25 for (int x = 0; x < bitmap.width(); x++) { 33 for (int x = 0; x < bitmap.width(); x++) {
26 *bitmap.getAddr32(x, y) |= (SK_A32_MASK << SK_A32_SHIFT); 34 *bitmap.getAddr32(x, y) |= (SK_A32_MASK << SK_A32_SHIFT);
27 } 35 }
28 } 36 }
29 } 37 }
30 38
31 void make_filepath(SkString* path, const SkString& dir, const SkString& name ) { 39 void make_filepath(SkString* path, const SkString& dir, const SkString& name ) {
32 size_t len = dir.size(); 40 size_t len = dir.size();
33 path->set(dir); 41 path->set(dir);
34 if (0 < len && '/' != dir[len - 1]) { 42 if (0 < len && '/' != dir[len - 1]) {
35 path->append("/"); 43 path->append("/");
36 } 44 }
37 path->append(name); 45 path->append(name);
38 } 46 }
39 47
40 namespace {
41 bool is_path_seperator(const char chr) {
42 #if defined(SK_BUILD_FOR_WIN)
43 return chr == '\\' || chr == '/';
44 #else
45 return chr == '/';
46 #endif
47 }
48 }
49
50 void get_basename(SkString* basename, const SkString& path) { 48 void get_basename(SkString* basename, const SkString& path) {
51 if (path.size() == 0) { 49 if (path.size() == 0) {
52 basename->reset(); 50 basename->reset();
53 return; 51 return;
54 } 52 }
55 53
56 size_t end = path.size() - 1; 54 size_t end = path.size() - 1;
57 55
58 // Paths pointing to directories often have a trailing slash, 56 // Paths pointing to directories often have a trailing slash,
59 // we remove it so the name is not empty 57 // we remove it so the name is not empty
(...skipping 24 matching lines...) Expand all
84 SkString skString(string); 82 SkString skString(string);
85 return skString.endsWith("%"); 83 return skString.endsWith("%");
86 } 84 }
87 85
88 void setup_bitmap(SkBitmap* bitmap, int width, int height) { 86 void setup_bitmap(SkBitmap* bitmap, int width, int height) {
89 bitmap->setConfig(SkBitmap::kARGB_8888_Config, width, height); 87 bitmap->setConfig(SkBitmap::kARGB_8888_Config, width, height);
90 bitmap->allocPixels(); 88 bitmap->allocPixels();
91 bitmap->eraseColor(SK_ColorTRANSPARENT); 89 bitmap->eraseColor(SK_ColorTRANSPARENT);
92 } 90 }
93 } 91 }
OLDNEW
« no previous file with comments | « experimental/StrokePathRenderer/GrStrokePathRenderer.cpp ('k') | tools/render_pictures_main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698