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

Side by Side Diff: samplecode/SampleApp.cpp

Issue 1306443004: Use static_assert instead of SK_COMPILE_ASSERT. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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/private/SkRecords.h ('k') | src/core/SkCanvas.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 * Copyright 2011 Google Inc. 2 * Copyright 2011 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 "SampleApp.h" 8 #include "SampleApp.h"
9 9
10 #include "OverView.h" 10 #include "OverView.h"
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 }; 591 };
592 592
593 static const struct TilingInfo gTilingInfo[] = { 593 static const struct TilingInfo gTilingInfo[] = {
594 { "No tiling", SK_Scalar1 , SK_Scalar1 }, // kNo_Tiling 594 { "No tiling", SK_Scalar1 , SK_Scalar1 }, // kNo_Tiling
595 { "128x128" , SkIntToScalar(128), SkIntToScalar(128) }, // kAbs_128x128_Til ing 595 { "128x128" , SkIntToScalar(128), SkIntToScalar(128) }, // kAbs_128x128_Til ing
596 { "256x256" , SkIntToScalar(256), SkIntToScalar(256) }, // kAbs_256x256_Til ing 596 { "256x256" , SkIntToScalar(256), SkIntToScalar(256) }, // kAbs_256x256_Til ing
597 { "1/4x1/4" , SK_Scalar1 / 4 , SK_Scalar1 / 4 }, // kRel_4x4_Tiling 597 { "1/4x1/4" , SK_Scalar1 / 4 , SK_Scalar1 / 4 }, // kRel_4x4_Tiling
598 { "1/1x1/16" , SK_Scalar1 , SK_Scalar1 / 16 }, // kRel_1x16_Tiling 598 { "1/1x1/16" , SK_Scalar1 , SK_Scalar1 / 16 }, // kRel_1x16_Tiling
599 { "1/16x1/1" , SK_Scalar1 / 16 , SK_Scalar1 }, // kRel_16x1_Tiling 599 { "1/16x1/1" , SK_Scalar1 / 16 , SK_Scalar1 }, // kRel_16x1_Tiling
600 }; 600 };
601 SK_COMPILE_ASSERT((SK_ARRAY_COUNT(gTilingInfo) == kLast_TilingMode_Enum), 601 static_assert((SK_ARRAY_COUNT(gTilingInfo) == kLast_TilingMode_Enum),
602 Incomplete_tiling_labels); 602 "Incomplete_tiling_labels");
603 603
604 SkSize SampleWindow::tileSize() const { 604 SkSize SampleWindow::tileSize() const {
605 SkASSERT((TilingMode)fTilingMode < kLast_TilingMode_Enum); 605 SkASSERT((TilingMode)fTilingMode < kLast_TilingMode_Enum);
606 const struct TilingInfo* info = gTilingInfo + fTilingMode; 606 const struct TilingInfo* info = gTilingInfo + fTilingMode;
607 return SkSize::Make(info->w > SK_Scalar1 ? info->w : this->width() * info->w , 607 return SkSize::Make(info->w > SK_Scalar1 ? info->w : this->width() * info->w ,
608 info->h > SK_Scalar1 ? info->h : this->height() * info-> h); 608 info->h > SK_Scalar1 ? info->h : this->height() * info-> h);
609 } 609 }
610 ////////////////////////////////////////////////////////////////////////////// 610 //////////////////////////////////////////////////////////////////////////////
611 611
612 static SkView* curr_view(SkWindow* wind) { 612 static SkView* curr_view(SkWindow* wind) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 static const SampleWindow::DeviceType gCT[] = { 666 static const SampleWindow::DeviceType gCT[] = {
667 SampleWindow::kPicture_DeviceType, 667 SampleWindow::kPicture_DeviceType,
668 #if SK_SUPPORT_GPU 668 #if SK_SUPPORT_GPU
669 SampleWindow::kGPU_DeviceType, 669 SampleWindow::kGPU_DeviceType,
670 #if SK_ANGLE 670 #if SK_ANGLE
671 SampleWindow::kANGLE_DeviceType, 671 SampleWindow::kANGLE_DeviceType,
672 #endif // SK_ANGLE 672 #endif // SK_ANGLE
673 #endif // SK_SUPPORT_GPU 673 #endif // SK_SUPPORT_GPU
674 SampleWindow::kRaster_DeviceType, 674 SampleWindow::kRaster_DeviceType,
675 }; 675 };
676 SK_COMPILE_ASSERT(SK_ARRAY_COUNT(gCT) == SampleWindow::kDeviceTypeCnt, array _size_mismatch); 676 static_assert(SK_ARRAY_COUNT(gCT) == SampleWindow::kDeviceTypeCnt, "array_si ze_mismatch");
677 return gCT[ct]; 677 return gCT[ct];
678 } 678 }
679 679
680 static SkString getSampleTitle(const SkViewFactory* sampleFactory) { 680 static SkString getSampleTitle(const SkViewFactory* sampleFactory) {
681 SkView* view = (*sampleFactory)(); 681 SkView* view = (*sampleFactory)();
682 SkString title; 682 SkString title;
683 SampleCode::RequestTitle(view, &title); 683 SampleCode::RequestTitle(view, &title);
684 view->unref(); 684 view->unref();
685 return title; 685 return title;
686 } 686 }
(...skipping 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after
1935 static const char* gDeviceTypePrefix[] = { 1935 static const char* gDeviceTypePrefix[] = {
1936 "raster: ", 1936 "raster: ",
1937 "picture: ", 1937 "picture: ",
1938 #if SK_SUPPORT_GPU 1938 #if SK_SUPPORT_GPU
1939 "opengl: ", 1939 "opengl: ",
1940 #if SK_ANGLE 1940 #if SK_ANGLE
1941 "angle: ", 1941 "angle: ",
1942 #endif // SK_ANGLE 1942 #endif // SK_ANGLE
1943 #endif // SK_SUPPORT_GPU 1943 #endif // SK_SUPPORT_GPU
1944 }; 1944 };
1945 SK_COMPILE_ASSERT(SK_ARRAY_COUNT(gDeviceTypePrefix) == SampleWindow::kDeviceType Cnt, 1945 static_assert(SK_ARRAY_COUNT(gDeviceTypePrefix) == SampleWindow::kDeviceTypeCnt,
1946 array_size_mismatch); 1946 "array_size_mismatch");
1947 1947
1948 static const char* trystate_str(SkOSMenu::TriState state, 1948 static const char* trystate_str(SkOSMenu::TriState state,
1949 const char trueStr[], const char falseStr[]) { 1949 const char trueStr[], const char falseStr[]) {
1950 if (SkOSMenu::kOnState == state) { 1950 if (SkOSMenu::kOnState == state) {
1951 return trueStr; 1951 return trueStr;
1952 } else if (SkOSMenu::kOffState == state) { 1952 } else if (SkOSMenu::kOffState == state) {
1953 return falseStr; 1953 return falseStr;
1954 } 1954 }
1955 return NULL; 1955 return NULL;
1956 } 1956 }
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
2368 setenv("ANDROID_ROOT", "/android/device/data", 0); 2368 setenv("ANDROID_ROOT", "/android/device/data", 0);
2369 #endif 2369 #endif
2370 SkGraphics::Init(); 2370 SkGraphics::Init();
2371 SkEvent::Init(); 2371 SkEvent::Init();
2372 } 2372 }
2373 2373
2374 void application_term() { 2374 void application_term() {
2375 SkEvent::Term(); 2375 SkEvent::Term();
2376 SkGraphics::Term(); 2376 SkGraphics::Term();
2377 } 2377 }
OLDNEW
« no previous file with comments | « include/private/SkRecords.h ('k') | src/core/SkCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698